Skip to content

Commit bf2e2ed

Browse files
zevdgyyx990803
authored andcommitted
types: allow functional components to return multiple VNodes (#8192)
close #8191
1 parent 46b8d2c commit bf2e2ed

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Diff for: types/options.d.ts

+1-1
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> {

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

+10
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,16 @@ Vue.component('functional-component-check-optional', {
354354
functional: true
355355
})
356356

357+
Vue.component('functional-component-multi-root', {
358+
functional: true,
359+
render(h) {
360+
return [
361+
h("tr", [h("td", "foo"), h("td", "bar")]),
362+
h("tr", [h("td", "lorem"), h("td", "ipsum")])
363+
]
364+
}
365+
})
366+
357367
Vue.component("async-component", ((resolve, reject) => {
358368
setTimeout(() => {
359369
resolve(Vue.component("component"));

0 commit comments

Comments
 (0)