Skip to content

Popconfirm 气泡确认框

弹出气泡确认框。 PopconfirmPopover 基础上做了常用封装。

基础用法

点击弹出 Popconfirm

查看代码
vue
<template>
	<demo-container>
		<gov-popconfirm
			title="这是一段内容确定删除吗?"
			icon="info"
			iconColor="red"
			placement="right"
		>
			<template #reference>
				<gov-button icon="delete">点击删除</gov-button>
			</template>
		</gov-popconfirm>
	</demo-container>
</template>

自定义内容

也可以不用icontitle属性,使用默认插槽。

查看代码
vue
<template>
	<demo-container>
		<gov-popconfirm
			placement="right"
			confirmButtonText="是的,确定"
			cancelButtonText="不是,点击关闭"
			confirmButtonType="primary"
			cancelButtonType="default"
			@cancel="handleCancel"
			@confirm="handleConfirm"
		>
			<div>下图是本站LOGO吗?</div>
			<img src="/logo.png" width="200" />
			<template #reference>
				<gov-button icon="mouse">点击触发</gov-button>
			</template>
		</gov-popconfirm>
	</demo-container>
</template>

<script setup>
import { GovMessage } from "@/dist/index.js";
const handleCancel = () => {
	GovMessage("点击了cancel");
};

const handleConfirm = () => {
	GovMessage("点击了confirm");
};
</script>

Attributes

PopconfirmPopover 基础上做了常用封装,重复属性请参考 Popover 文档,在此文档不再赘述。

参数说明类型可选值默认值
title标题String
confirm-button-text确认按钮文字String确定
cancel-button-text取消按钮文字String取消
confirm-button-type确认按钮类型Stringprimary
cancel-button-type取消按钮类型Stringtext
iconIconString
icon-colorIcon 颜色String

Slots

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

Events

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

Released under the MIT License.