//which tag I may use or ..."> //which tag I may use or ..."/> //which tag I may use or ..."> //which tag I may use or ...">

如何在没有任何html标记或其他标记的情况下使用v-if和v-else

vue.js Vue.js

Gil伽罗

2020-03-12

项目清单

<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过程中使用它。

第1318篇《如何在没有任何html标记或其他标记的情况下使用v-if和v-else》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

2个回答
JinJinGil 2020.03.12

您有时可以使用该<slot>元素来制作所需的内容。这里查看插槽说明文件

猿神奇 2020.03.12

您可以使用template

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

模板不会在浏览器中呈现。但是它将把其中的内容解析为html。

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android