Skip to content

Interface: ComponentContext<C, K>

API / @xmachines/play-vue / ComponentContext

Defined in: @json-render/vue

Context passed to component render functions

Example

const Button: ComponentFn<typeof catalog, "Button"> = (ctx) => {
return h("button", { onClick: () => ctx.emit("press") }, ctx.props.label);
};

Extends

  • BaseComponentProps<InferComponentProps<C, K>>

Type Parameters

Type Parameter
C extends Catalog
K extends keyof InferCatalogComponents<C>

Properties

PropertyTypeDescriptionInherited fromDefined in
bindings?Record<string, string>Two-way binding paths resolved from $bindState / $bindItem expressions. Maps prop name → absolute state path for write-back.BaseComponentProps.bindings-
children?| VNode<RendererNode, RendererElement, { [key: string]: any; }> | VNode<RendererNode, RendererElement, { [key: string]: any; }>[]Rendered children (from the default slot)BaseComponentProps.children-
emit(event) => voidSimple event emitter (shorthand). Fires the event and returns void.BaseComponentProps.emit-
loading?boolean-BaseComponentProps.loading-
on(event) => EventHandleGet an event handle with metadata. Use when you need shouldPreventDefault or bound checks.BaseComponentProps.on-
propsInferComponentProps-BaseComponentProps.props-