Vue: can vuejs support "Fragments" tag, just like react

Created on 29 Mar 2018  ·  4Comments  ·  Source: vuejs/vue

What problem does this feature solve?

can vuejs support "Fragments" tag, just like react

What does the proposed API look like?

<template> <Fragment v-for="item in lst" key={item.id}> <dt>{item.term}</dt> <dd>{item.description}</dd> <Fragment > <template>

All 4 comments

For the time being, I think the suggested solution is to use a render function which can result in an array of items:

render(h) {
  return this.lst.map(item => h('dt', {props}))
}

@ejweiler but this is only supported in functional component

@sqal if you _need_ to output multiple elements at the root level of a component it might be the only current option, so why not use a functional component for it?

Duplicated of #7088

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loki0609 picture loki0609  ·  3Comments

6pm picture 6pm  ·  3Comments

bfis picture bfis  ·  3Comments

lmnsg picture lmnsg  ·  3Comments

julianxhokaxhiu picture julianxhokaxhiu  ·  3Comments