zoukankan      html  css  js  c++  java
  • vue阻止事件

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title></title>
    <script src="vue.js" type="text/javascript" charset="utf-8"></script>
    <link href="./02.css" type="text/css" rel="stylesheet" />
    </head>
    <body>
    <div id="vue-app03">
    <p>My name is : {{age}}</p>
    <button @click.once="add(1)">长一岁</button>
    <div id="a" v-on:mousemove="takeXY">
    {{x}} , {{y}} -
    <span v-on:mousemove="stopMoving">stopMoving</span>
    <span v-on:mousemove.stop="">stopMoving</span>
    </div>
    <a href="http://www.baidu.com" v-on:click.prevent="alert()">the new step</a>
    </div>
    <script src="event%20adj.js" type="text/javascript" charset="utf-8"></script>
    </body>
    </html>

    new Vue({
    el:"#vue-app03",
    data:{
    age:30,
    x:0,
    y:0,
    },
    methods:{
    add:function(inc){
    this.age+=inc;
    },
    takeXY:function(event){
    this.x=event.offsetX;
    this.y=event.offsetY;
    },
    stopMoving:function(event){

    /*
    阻止冒泡事件
    */
    event.stopPropagation();
    },
    alert:function(){
    alert("hello");

    }
    }
    })

  • 相关阅读:
    ShaderLab 枚举常量
    PHP to .NET Compiler
    填充圆算法
    战争迷雾
    A*
    寻路算法
    Unity中将动画片段保存为文件
    令人蛋疼的错误提示 0xcdcdcdcd ,0xdddddddd ,0xfeeefeee ,0xcccccccc ,0xabababab
    2D光照
    Rider 2018 激活码
  • 原文地址:https://www.cnblogs.com/weixin2623670713/p/12865084.html
Copyright © 2011-2022 走看看