console
const ap=new Vue({
el:'#app',
data:{
message:'事件监听v-on',
counter:0,
},
methods:{
increment(){
this.counter++;
},
decrement(){
this.counter--;
},
eventment(name)
{
console.log(name);
}
},
});
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="app" style="max-width:800px;height:400px">
<h2>{{message}}</h2>
<h2>{{counter}}</h2>
<button v-on:click="increment">+</button>
<button v-on:click="decrement">-</button>
<button v-on:click="eventment()">事件</button>
<div @click="eventment('e')"> 单击
<button @click.stop="eventment('55')">事件</button>
</div>
<input @keyup="eventment(55)"/>
<input @keyup.enter="eventment(55)"/>
<button @click.once="eventment('一次')">只触发一次</button>
</div>