How to use v-if and v-else without any html tag or

2019-06-15 16:20发布

List item

<ul>
 <li>language</li>

   < v-if= "tree()"> //which tag I may use or any other process
    <li>home</li>
    <li>about</li>
   <>
   < v-else> //which tag I may use or any other process
    <li>accounts</li>
    <li>listing</li>
   <>
</ul>'

In the V-if which html tag i may use or any other vue.js process to work with this.

标签: vue.js
2条回答
时光不老,我们不散
2楼-- · 2019-06-15 16:57

You can use template:

<template v-if="condition">
</template>
<template v-else>
</template>

Template will not be rendered in the browser. But it will parse the contents inside of this to the html.

查看更多
Evening l夕情丶
3楼-- · 2019-06-15 17:13

you can sometimes use the <slot> element to make what you want. Have a look at the slot documentation here

查看更多
登录 后发表回答