Skip to content

Commit 699f44d

Browse files
committed
types: allow functional components to return multiple VNodes
close vuejs#8191
1 parent 5e3823a commit 699f44d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

types/options.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export interface FunctionalComponentOptions<Props = DefaultProps, PropDefs = Pro
113113
props?: PropDefs;
114114
inject?: InjectOptions;
115115
functional: boolean;
116-
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode;
116+
render?(this: undefined, createElement: CreateElement, context: RenderContext<Props>): VNode | VNode[];
117117
}
118118

119119
export interface RenderContext<Props=DefaultProps> {

types/test/options-test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,16 @@ Vue.component('functional-component-check-optional', {
338338
functional: true
339339
})
340340

341+
Vue.component('functional-component-multi-root', {
342+
functional: true,
343+
render(h) {
344+
return [
345+
h("tr", [h("td", "foo"), h("td", "bar")]),
346+
h("tr", [h("td", "lorem"), h("td", "ipsum")])
347+
]
348+
}
349+
})
350+
341351
Vue.component("async-component", ((resolve, reject) => {
342352
setTimeout(() => {
343353
resolve(Vue.component("component"));

0 commit comments

Comments
 (0)