Skip to content

使用stop

html
<div @click="test1()">    
    <span @click.stop="test2()">按钮1</span>    
    <span>按钮2</span> 
</div>
<div @click="test1()">    
    <span @click.stop="test2()">按钮1</span>    
    <span>按钮2</span> 
</div>

阻止冒泡事件

html
<div>
    <div @click="_stopPropagation($event)"></div>
</div>
<div>
    <div @click="_stopPropagation($event)"></div>
</div>
js
methods{      
    _stopPropagation(ev){      
        var _this = this;      
        ev.stopPropagation();      
    },
}
methods{      
    _stopPropagation(ev){      
        var _this = this;      
        ev.stopPropagation();      
    },
}