- 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版)
- Getting Started with Gulp(Second Edition)
- C程序設計簡明教程(第二版)
- Mastering ServiceStack
- C語言程序設計(第2 版)
- MATLAB 2020 從入門到精通
- Essential Angular
- Learning Python Design Patterns(Second Edition)
- Effective Python Penetration Testing
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- Learning Hunk
- Android Wear Projects
- PHP+Ajax+jQuery網站開發項目式教程
- CRYENGINE Game Development Blueprints
- JSP程序設計實例教程(第2版)