-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
Description
What problem does this feature solve?
From compiling template error message:
Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
But Cannot use
as component root element because it may contain multiple nodes.
So I can't use <template>
as component root element even if it contains only one node.
What does the proposed API look like?
Allow the following code as component root.
<template v-if="conditionA">
<div v-if="conditionC"></div>
<div v-else-if="conditionD"></div>
<div v-else></div>
</template>
<template v-else>
<div></div>
</template>
Do not allow the following code as component root.
<template>
<div v-if="conditionA"></div>
<div v-if="conditionB"></div>
</template>
Oleg-Arkhipov, feliperaul, ndabAP, fritx, vizo and 54 moreiSWORDdsonet, feliperaul, AngelMunoz, codeams, KazimirPodolski and 5 more