<html>
<body>
<div id="app">
</br>
<!-- 正常写法 -->
<p v-on:mousemove="myMouseMove"> 鼠标移动 </p>
</br>
mouseX:{{myMouseX}} </br>
mouseX:{{myMouseY}} </br>
</br>
<!-- 缩写写法 -->
<p @mousemove="myMouseStop"> 鼠标停止1 </p>
</br>
<!-- 事件修饰符 -->
<p @mousemove.stop> 鼠标停止2 </p>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
new Vue({
//指定作用于那一个div
el:'#app',
//属性
data:{
myMouseX:0,
myMouseY:0,
},
methods:{
myMouseMove:function(event){
this.myMouseX=event.clientX;
this.myMouseY=event.clientY;
},
myMouseStop:function(event){
event.stopPropagation();
}
}
});
</script>
</html>