README
popconfirm 气泡确认框
点击元素,弹出气泡式的确认框。
何时使用
目标元素的操作需要用户进一步的确认时,在目标元素附近弹出浮层提示,询问用户。
和 ‘confirm’ 弹出的全屏居中模态对话框相比,交互形式更轻量,目标更明确。
代码演示
<template>
<popconfirm title="确认删除?" okText="确认" cancelText="取消" @confirm="() => onDelete(11)">
<a href="javascript:void(0);">删除</a>
</popconfirm>
</template>
<script>
export default {
methods: {
onDelete (id) {
console.log(id)
}
}
}
</script>
API
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
cancelText | 取消按钮文字 | String | 取消 |
okText | 确认按钮文字 | String | 确定 |
title | 标题 | String | 确认执行此操作吗? |
placement | 出现位置(top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end) | String | top-end |
type | 确认类型(warning/danger) | String | warning |
事件
事件名称 | 说明 | 回调参数 |
---|---|---|
cancel | 点击取消的回调 | function(e) |
confirm | 点击确认的回调 | function(e) |