- 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>
推薦閱讀
- 測試驅動開發(fā):入門、實戰(zhàn)與進階
- FreeSWITCH 1.6 Cookbook
- Mastering C# Concurrency
- Python高效開發(fā)實戰(zhàn):Django、Tornado、Flask、Twisted(第2版)
- Go并發(fā)編程實戰(zhàn)
- Learning DHTMLX Suite UI
- RSpec Essentials
- C#開發(fā)案例精粹
- 微信小程序開發(fā)與實戰(zhàn)(微課版)
- 精通MySQL 8(視頻教學版)
- Arduino可穿戴設備開發(fā)
- Machine Learning for Developers
- IoT Projects with Bluetooth Low Energy
- 深入解析Java編譯器:源碼剖析與實例詳解
- Java EE Web應用開發(fā)基礎