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

franciscolourenco picture franciscolourenco  路  3Comments

paulpflug picture paulpflug  路  3Comments

seemsindie picture seemsindie  路  3Comments

bdedardel picture bdedardel  路  3Comments

fergaldoyle picture fergaldoyle  路  3Comments