关于element ui,el-popconfirm,点击事件不生效,confirm,cancel,@confirm不生效的问题

3 篇文章 0 订阅
2 篇文章 0 订阅

element ui,el-popconfirm,
confirm,cancel,点击事件
@confirm不生效

开发文档中是 @confirm

实际使用是 @onConfirm

<el-popconfirm style="margin-left: 20px;" title="此操作将清空所填内容并关闭,是否继续?" @onConfirm="submitForm('ruleForm',2)" >
<el-button slot="reference" type="info" plain >取 消</el-button>
</el-popconfirm>

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
要将el-popconfirm放入el-popover中使用,可以按照以下步骤进行操作: 1. 首先,在需要使用el-popover的地方添加el-popover组件,并设置相应的属性,例如触发方式、内容等。 2. 在el-popover的内容中,添加el-popconfirm组件,并设置相应的属性,例如标题、确认按钮文本等。 3. 在el-popconfirm中,可以使用el-button等组件作为触发按钮,点击触发按钮时会显示确认框。 4. 在确认按钮的点击事件中,可以执行相应的逻辑操作。 下面是一个示例代码,演示了如何将el-popconfirm放入el-popover中使用: ```html <template> <div> <el-popover placement="top" title="Popover Title" trigger="click" content="Popover Content" > <el-button type="primary">Click me</el-button> <template slot="reference"> <el-popconfirm title="Are you sure to delete?" confirm-button-text="Yes" cancel-button-text="No" @confirm="handleConfirm" > <el-button type="danger">Delete</el-button> </el-popconfirm> </template> </el-popover> </div> </template> <script> export default { methods: { handleConfirm() { // 执行删除操作 console.log("Delete confirmed"); }, }, }; </script> ``` 在上述示例中,点击"Click me"按钮会触发el-popover的显示,同时在popover中显示了一个"Delete"按钮。当点击"Delete"按钮时,会弹出确认框,点击确认按钮会执行`handleConfirm`方法,输出"Delete confirmed"。 希望以上信息能够帮助到你!如果有任何疑问,请随时提问。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值