Skip to content

Commit 496635e

Browse files
posvayyx990803
authored andcommitted
types: add model option to functional components (#8212)
Closes #8210
1 parent bf2e2ed commit 496635e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Diff for: types/options.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ export interface ComponentOptions<
111111
export interface FunctionalComponentOptions<Props = DefaultProps, PropDefs = PropsDefinition<Props>> {
112112
name?: string;
113113
props?: PropDefs;
114+
model?: {
115+
prop?: string;
116+
event?: string;
117+
};
114118
inject?: InjectOptions;
115119
functional: boolean;
116120
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode | VNode[];

Diff for: types/test/options-test.ts

+20
Original file line numberDiff line numberDiff line change
@@ -376,4 +376,24 @@ Vue.component("async-component", ((resolve, reject) => {
376376
})
377377
}));
378378

379+
Vue.component('functional-component-v-model', {
380+
props: ['foo'],
381+
functional: true,
382+
model: {
383+
prop: 'foo',
384+
event: 'change'
385+
},
386+
render(createElement, context) {
387+
return createElement("input", {
388+
on: {
389+
input: new Function()
390+
},
391+
domProps: {
392+
value: context.props.foo
393+
}
394+
});
395+
}
396+
});
397+
398+
379399
Vue.component('async-es-module-component', () => import('./es-module'))

0 commit comments

Comments
 (0)