vue使用once修饰符|vue使用once修饰符,使事件只能触发一次问题

目录

  • once修饰符,使事件只能触发一次
  • vue事件修饰符(once:prev:stop)
    • 注释说的很详细
【vue使用once修饰符|vue使用once修饰符,使事件只能触发一次问题】
once修饰符,使事件只能触发一次 多个修饰符可以同步使用



vue事件修饰符(once:prev:stop) 附有同一文件夹下的html文件、js文件和css文件

注释说的很详细
index.html的代码
vue Event My age is {{age}}
{{x}},{{y}} - Stop Moving
Stop Moving baidu
baidu

app.js的代码
//实例化VUE对象new Vue({ el:"#vue-app", //仅限于在vue-app容器下 data:{age:30,x:0,y:0}, methods:{add:function(inc){this.age += inc; },subtract:function(dec){this.age -= dec; },updateXY:function(event){this.x = event.offsetX; this.y = event.offsetY; },stopMoving:function(event){event.stopPropagation(); },alert:function(){alert("Hellow world !"); } }});

style.css代码
#canvas{ width: 600px; padding: 200px 20px; text-align: center; border: 1px solid #333; }

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

    推荐阅读