<div id="root"> <h2>Keep going, {{name}}! </h2> <!-- Prevent default events --> <a @click.prevent="showInfo" href="https:www.baidu.com">Click me for prompt information</a> <!-- Prevent event bubbling --> <div class="demo1" @click="showInfo"> <button @click.stop="showInfo">Click me for information</button> </div> <!-- Event is triggered only once --> <button @click.once="showInfo">Click me for information</button> <!-- Use event capture mode --> <div class="box1" @click.capture="showMsg(1)"> div1 <div class="box2" @click="showMsg(2)"> div2 </div> </div> <!-- The event is triggered only when event.target is the element currently being operated on --> <div class="demo1" @click.self="showInfo"> <button @click="showInfo">Click me for info</button> </div> </div> <script> Vue.config.productionTip = false; new Vue({ el: '#root', data() { return { name: 'Zhang San' } }, methods: { showInfo(e) { // e.preventDefault(); alert('Hello, Mr. Wang!') }, showMsg(msg) { console.log(msg); } } }); </script> SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: HTML checkbox Click the description text to select/uncheck the state
>>: 25 Tools to Improve Website Usability and Conversion Rates
1. Environment VS 2019 16.9.0 Preview 1.0 .NET SD...
When a company developer executes an insert state...
This tutorial shares the installation of mysql in...
Today I will talk about a CSS special effect of h...
Although I have run some projects in Docker envir...
Generally speaking, when we view the contents of ...
Rem layout adaptation The styles in Vant use px a...
Here I use samba (file sharing service) v4.9.1 + ...
To summarize the form submission method: 1. Use t...
Table of contents Initialize computed Dependency ...
The preparation for the final exams in the past h...
Preface If you use the overflow: scroll attribute...
Table of contents 1. Basic Concepts ACID 3.AutoCo...
Preface This article will focus on the use of Typ...
Table of contents 1. Index Basics 1. Types of Ind...