如何在没有任何 html 标签或 else 的情况下使用 v-if 和 v-else [英] How to use v-if and v-else without any html tag or else
本文介绍了如何在没有任何 html 标签或 else 的情况下使用 v-if 和 v-else的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<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>'
在 V-if
中,我可以使用哪个 html 标签或任何其他 vue.js
进程来处理这个.
In the V-if
which html tag i may use or any other vue.js
process to work with this.
推荐答案
您可以使用 模板:
<template v-if="condition">
</template>
<template v-else>
</template>
模板不会在浏览器中呈现.但它会将 this 里面的内容解析为 html.
Template will not be rendered in the browser. But it will parse the contents inside of this to the html.
这篇关于如何在没有任何 html 标签或 else 的情况下使用 v-if 和 v-else的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文