Browse Source

types: add model option to functional components (#8212)

Closes #8210
dev
Eduardo San Martin Morote 6 years ago
committed by Evan You
parent
commit
496635e7c9
  1. 4
      types/options.d.ts
  2. 20
      types/test/options-test.ts

4
types/options.d.ts

@ -111,6 +111,10 @@ export interface ComponentOptions<
export interface FunctionalComponentOptions<Props = DefaultProps, PropDefs = PropsDefinition<Props>> {
name?: string;
props?: PropDefs;
model?: {
prop?: string;
event?: string;
};
inject?: InjectOptions;
functional: boolean;
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode | VNode[];

20
types/test/options-test.ts

@ -376,4 +376,24 @@ Vue.component("async-component", ((resolve, reject) => {
})
}));
Vue.component('functional-component-v-model', {
props: ['foo'],
functional: true,
model: {
prop: 'foo',
event: 'change'
},
render(createElement, context) {
return createElement("input", {
on: {
input: new Function()
},
domProps: {
value: context.props.foo
}
});
}
});
Vue.component('async-es-module-component', () => import('./es-module'))

Loading…
Cancel
Save