ElementPlus Popconfirm 气泡确认框

Popconfirm 气泡确认框

点击元素,弹出气泡确认框。

基础用法

Popconfirm 的属性与 Popover 很类似,因此对于重复属性,请参考 Popover 的文档,在此文档中不做详尽解释。

ElementPlus Popconfirm 气泡确认框

在 Popconfirm 中,只有 title 属性可用,content 属性不会被展示。

<template>
  <el-popconfirm title="这是一段内容确定删除吗?">
    <template #reference>
      <el-button>删除</el-button>
    </template>
  </el-popconfirm>
</template>

自定义

可以在 Popconfirm 中自定义内容。

ElementPlus Popconfirm 气泡确认框

<template>
  <el-popconfirm
    confirmButtonText="好的"
    cancelButtonText="不用了"
    icon="el-icon-info"
    iconColor="red"
    title="这是一段内容确定删除吗?"
  >
    <template #reference>
      <el-button>删除</el-button>
    </template>
  </el-popconfirm>
</template>

触发事件

点击按钮触发事件

ElementPlus Popconfirm 气泡确认框

<template>
  <el-popconfirm
    confirmButtonText="确定"
    cancelButtonText="取消"
    icon="el-icon-info"
    iconColor="red"
    title="这是一段内容确定删除吗?"
    @confirm="confirmEvent"
    @cancel="cancelEvent"
  >
    <template #reference>
      <el-button>删除</el-button>
    </template>
  </el-popconfirm>
</template>

<script>
  export default {
    methods: {
      confirmEvent() {
        console.log(confirm!)
      },
      cancelEvent() {
        console.log(cancel!)
      },
    },
  }
</script>

Attributes

参数说明类型可选值默认值
title标题String
confirmButtonText确认按钮文字String
cancelButtonText取消按钮文字String
confirmButtonType确认按钮类型StringPrimary
cancelButtonType取消按钮类型StringText
iconIconStringel-icon-question
iconColorIcon 颜色String#f90
hideIcon是否隐藏 IconBooleanfalse

Slot

参数说明
reference触发 Popconfirm 显示的 HTML 元素

Events

事件名称说明回调参数
confirm点击确认按钮时触发
cancel点击取消按钮时触发

作者:terry,如若转载,请注明出处:https://www.web176.com/elementplus/19831.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2023年5月8日
下一篇 2023年5月8日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注