Skip to content

Commit

Permalink
types: allow functional components to return multiple VNodes (#8192)
Browse files Browse the repository at this point in the history
close #8191
  • Loading branch information
zevdg authored and yyx990803 committed Oct 24, 2018
1 parent 46b8d2c commit bf2e2ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export interface FunctionalComponentOptions<Props = DefaultProps, PropDefs = Pro
props?: PropDefs;
inject?: InjectOptions;
functional: boolean;
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode;
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode | VNode[];
}

export interface RenderContext<Props=DefaultProps> {
Expand Down
10 changes: 10 additions & 0 deletions types/test/options-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ Vue.component('functional-component-check-optional', {
functional: true
})

Vue.component('functional-component-multi-root', {
functional: true,
render(h) {
return [
h("tr", [h("td", "foo"), h("td", "bar")]),
h("tr", [h("td", "lorem"), h("td", "ipsum")])
]
}
})

Vue.component("async-component", ((resolve, reject) => {
setTimeout(() => {
resolve(Vue.component("component"));
Expand Down

0 comments on commit bf2e2ed

Please sign in to comment.