<script>
    export default{
        methods: {
            confirm(){
                this.$message.info('您已经确认该操作')
            },
            cancel(){
                this.$message.info('您已经取消该操作')
            }
        }
    }
</script>
# Popconfirm 气泡确认框

点击元素，弹出气泡式的确认框。

## 何时使用

* 目标元素的操作需要用户进一步的确认时，在目标元素附近弹出浮层提示，询问用户。
* 和 confirm 弹出的全屏居中模态对话框相比，交互形式更轻量。

### 基本用法

::: demo 最简单的用法。ok-text（默认：确定）确认按钮文字,cancel-text（默认：取消）取消按钮文字。
```html
<template>
    <ut-popconfirm title='你确定要删除么' ok-text='确定' cancel-text='取消'>
        <ut-button type='danger'>删除</ut-button>
    </ut-popconfirm>
</template>
```
:::

### 多方向

::: demo 多方向 placement 同tooltip
```html
<template>
    <ut-popconfirm title='你确定要删除么' ok-text='确定' cancel-text='取消' placement='right'>
        <ut-button type='danger' plain>提示在右边</ut-button>
    </ut-popconfirm>
</template>
```
:::

### 事件

::: demo 确认事件<code>confirm</code>，取消事件<code>cancel</code>
```html
<template>
    <ut-popconfirm title='你确定要删除么' 
                   @confirm='confirm'
                   @cancel='cancel'
                   ok-text='确定'
                   cancel-text='取消' 
                   placement='right'>
        <ut-button type='danger' plain>提示</ut-button>
    </ut-popconfirm>
</template>
<script>
    export default{
        methods: {
            confirm(){
                this.$message.info('您已经确认该操作')
            },
            cancel(){
                this.$message.info('您已经取消该操作')
            }
        }
    }
</script>
```
:::