开发中需要用到二次确认按钮,防止误触等操作。
原代码为:
el-button @click="changeBtn()">修改</el-button>
(修改函数已省略)
加入二次确认功能后,代码改为:
<el-popconfirm title="这是一段内容确定删除吗?" @confirm="change()">
<el-button slot="reference">修改</el-button>
</el-popconfirm>
其中,@confirm表示确认后触发的函数;@cancel表示取消后触发的函数(默认为取消后关闭二次提示框)

本文介绍如何在 Element UI 的 el-button 中加入二次确认功能,通过 el-popconfirm 组件实现防止误操作的功能。

被折叠的 条评论
为什么被折叠?



