查了许久源码,发现是冒泡问题
下面附上解决方案:
修改前:
<el-popconfirm title="删除?" @confirm="popConfirm" @cancel="popCancel">
<el-button type="danger" size="mini" slot="reference" icon="el-icon-delete">删除</el-button>
</el-popconfirm>
修改后:
<span @click="delBtn">
<el-popconfirm title="删除?" @confirm="popConfirm" @cancel="popCancel">
<el-button
type="danger"
size="mini"
slot="reference"
icon="el-icon-delete"
>删除</el-button>
</el-popconfirm>
</span>
methods: {
popConfirm(){
console.log('确认')
},
popCancel(){
console.log('取消')
},
delBtn(e){
e.stopPropagation();
},
}
网友评论