console
new Vue({
el:"#app",
data:{
title:"hello world!",
x:0,
y:0
},
methods:{
changeTitle:function(ev){
this.title=ev.target.value
},
sayHello:function(){
return this.title;
},
updateCoordinates:function(event){
this.x = event.clientX;
this.y = event.clientY;
},
alertMe:function(){
return '我弹起按键了';
}
}
});
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<div id="app">
<input type="text" v-on:input="changeTitle()" />
<h2>{{title}}</h2>
<p v-on:mousemove="updateCoordinates">
Coordinates:{{x}}/{{y}}
-<span v-on:mousemove.stop.prevent="">DEAD START</span>
</p>
<input type="text" v-on:keyup="alertMe"/>
</div>