From 808dcd1d12a6e54e7974f802f49e332b1f771a32 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 21 May 2018 10:25:38 +0200 Subject: [PATCH] fix(types): add model option to functional components Closes #8210 --- types/options.d.ts | 4 ++++ types/test/options-test.ts | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/types/options.d.ts b/types/options.d.ts index cc58affe6a1..54ec0265218 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -111,6 +111,10 @@ export interface ComponentOptions< export interface FunctionalComponentOptions> { name?: string; props?: PropDefs; + model?: { + prop?: string; + event?: string; + }; inject?: InjectOptions; functional: boolean; render?(this: undefined, createElement: CreateElement, context: RenderContext): VNode; diff --git a/types/test/options-test.ts b/types/test/options-test.ts index 6fc9e356451..aeae68417fb 100644 --- a/types/test/options-test.ts +++ b/types/test/options-test.ts @@ -350,4 +350,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'))