Skip to content

Commit

Permalink
types: add model option to functional components (vuejs#8212)
Browse files Browse the repository at this point in the history
Closes vuejs#8210
  • Loading branch information
posva authored and yyx990803 committed Oct 24, 2018
1 parent bf2e2ed commit 496635e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down
20 changes: 20 additions & 0 deletions types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

0 comments on commit 496635e

Please sign in to comment.