Skip to content

conditional root template in .vue file #11198

@derMart

Description

@derMart

Version

2.6.11

Reproduction link

https://codesandbox.io/s/sad-benz-d69xb

Steps to reproduce

Not sure if this applies to vue or vue-loader. It seems v-if statements are not processed correctly when inside a root template tag.
Suppose you have the following .vue file:

<template v-if="true">
  <p>test</p>
</template>
<template v-else>
  <p>test2</p>
</template>

What is expected?

The test paragraph should be rendered as v-if is true (also tested with other more complicated truthy conditions)

What is actually happening?

The test2 paragraph is rendered.
It seems always the last template tag, having either v-else or any v-else-if statement is rendered, even if that v-else-if condition is false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions