- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 68字
- 2021-07-02 19:57:19
Example: v-if
v-ifwill conditionally render an element if its value is a truthy expression. In the following case,v-ifwill remove/insert thepelement depending on themyvalvalue:
<p id="app"> <p v-if="myval">Hello Vue</p> </p> <script> var app = new Vue({ el: '#app', data: { myval: true } }); </script>
Will renders as:
<p id="app"> <p>Hello Vue</p> </p>
If we add a consecutive element with thev-elsedirective (a special directive that requires no value), it will be symmetrically removed/inserted asmyvalchanges:
<p v-if="myval">Hello Vue</p> <p v-else>Goodbye Vue</p>
推薦閱讀
- Oracle從入門到精通(第3版)
- JBoss Weld CDI for Java Platform
- Java EE 6 企業級應用開發教程
- Hands-On Image Processing with Python
- 軟件測試項目實戰之性能測試篇
- 看透JavaScript:原理、方法與實踐
- UML+OOPC嵌入式C語言開發精講
- Python Network Programming Cookbook(Second Edition)
- Building a Recommendation Engine with Scala
- 量化金融R語言高級教程
- ASP.NET開發與應用教程
- Java實戰(第2版)
- 詳解MATLAB圖形繪制技術
- 匯編語言編程基礎:基于LoongArch
- JavaScript程序設計(第2版)