父组件中使用了@mousedown
<div @mousedown="handleMouseDown($event)"我是父组件按钮</div>handleMouseDown(e){// e.stopPropagation()// e.preventDefaultconsole.log("父组件点击了")}
方法就是子组件中不要使用click,也使用mousedown ,然后使用e.preventDefault()与e.stopPropagation()
<div @mousedown="handleMouseDown($event)"我是子组件按钮</div>handleMouseDown(e){e.stopPropagation()e.preventDefault()console.log("子组件点击了")}
挺简单的就是刚开始的时候没想到,在此记录下。