console
new Vue({
el:'#app',
data: {
counter:0,
x:0,
y:0
},
methods: {
increase: function(evevt) {
this.counter += 2;
},
updateCoordinates: function(event) {
this.x = event.clientX;
this.y = event.clientY;
},
alertMe: function() {
alert('Alert!!');
}
}
})
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="app">
<button v-on:click="increase(2,$event)">Click me</button>
<button v-on:click="counter++">Click me</button>
<p>{{ counter * 3 > 10 ? '大于10':'小于10'}}</p>
<p v-on:mousemove="updateCoordinates">Coordinates: {{ x }} / {{ y }}
-<span v-on:mousemove.stop=""> STOP </span>
</p>
<input type="text" v-on:keyup.enter.space="alertMe">
</div>