<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
A website uses a lot of HTML5 and CSS3, hoping th...
Mysql commonly used display commands 1. Display t...
To write a drop-down menu, click the button. The ...
1. MySql Architecture Before introducing the stor...
1. High degree of collapse In the document flow, ...
Original article, please indicate the author and ...
Currently, layui officials have not provided the ...
0. When I made this document, it was around Decem...
Recently, I need to do a small verification exper...
The main text page of TW used to have a width of 8...
1. Introduction Why do we need indexes? In genera...
Table of contents Preface 1. bat executes js 2. T...
Table of contents 1. What content usually needs t...
This article mainly introduces the wonderful use ...
I just learned some html yesterday, and I couldn...