- 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>
推薦閱讀
- 黑客攻防從入門到精通(實戰秘笈版)
- Flutter開發實戰詳解
- Linux C/C++服務器開發實踐
- HoloLens Beginner's Guide
- Python進階編程:編寫更高效、優雅的Python代碼
- Learning Python Design Patterns
- C程序設計實踐教程
- 案例式C語言程序設計實驗指導
- ArcGIS for Desktop Cookbook
- Shopify Application Development
- Developing Java Applications with Spring and Spring Boot
- Clojure編程樂趣
- C#網絡編程高級篇之網頁游戲輔助程序設計
- Enterprise Application Architecture with .NET Core
- Instant AppFog