Browse Source

types: allow functional components to return multiple VNodes (#8192)

close #8191
dev
Zev Goldstein 6 years ago
committed by Evan You
parent
commit
bf2e2ed159
  1. 2
      types/options.d.ts
  2. 10
      types/test/options-test.ts

2
types/options.d.ts

@ -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> {

10
types/test/options-test.ts

@ -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"));

Loading…
Cancel
Save