-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
Vue.js version
2.0.1
Reproduction Link
https://jsfiddle.net/alexman/h64y6bj1/1/
Steps to reproduce
Set up a standalone component with template:
<template>
<div v-if="isComplex"><slot></slot></div>
<button v-else><slot></slot></button>
</template>
And computed field:
computed: {
isComplex() {
return false // true
}
}
What is Expected?
v-if
with a v-else
following it resolves to exactly 1 component, so I believe it could be allowed and not throw an error about a missing root component.
Making isComplex()
return true
in the example should display a div
, and false
would display a button
.
What is actually happening?
Component template should contain exactly one root element:
<div v-if="isComplex"><slot></slot></div> <button v-else><slot></slot></button>
Plortinus, aurovrata, Etheryte and IrfDev
Metadata
Metadata
Assignees
Labels
No labels