- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 47字
- 2021-07-02 19:57:21
Event listener
We now want to remove thecontractedclass automatically when the user clicks theMorebutton. To do this job, we'll use thev-ondirective, which listens to DOM events with aclickargument.
The value of thev-ondirective can be an expression that assignscontractedtofalse.
index.html:
<p class="about"> <h3>About this listing</h3> <p v-bind:class="{ contracted: contracted }">{{ about }}</p> <button class="more" v-on:click="contracted = false">+ More</button> </p>
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- Java程序設計與開發
- 編程卓越之道(卷3):軟件工程化
- 區塊鏈架構與實現:Cosmos詳解
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- 名師講壇:Spring實戰開發(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- Julia 1.0 Programming Complete Reference Guide
- 代碼閱讀
- Spring 5 Design Patterns
- PowerDesigner 16 從入門到精通
- 奔跑吧 Linux內核
- Julia High Performance(Second Edition)
- Java EE架構設計與開發實踐
- Puppet Cookbook(Third Edition)
- jQuery基礎教程(第4版)