vue阻止冒泡

来源:互联网 发布:js缺省参数 编辑:程序博客网 时间:2024/06/05 11:03
<template>    <div class="main">        <img src="../../../static/img/wxmember.png" alt="">        <button @click="showBuy">立即购买</button>        <div class="buy" v-if="isBuy" @click="closeBuy">            <img src="../../../static/img/buyyear.png" alt="" @click="sureBuy($event)">        </div>    </div></template>
data () {    return {        isBuy:false,    }},methods: {    // 方法    showBuy(){        this.isBuy = true;    },    closeBuy(){        this.isBuy = false;    },    sureBuy(event){        event.cancelBubble = true;    }},