mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-16 20:34:20 +08:00

* feat(components): [popconfirm] add actions slot close #4733 * feat(components): [popconfirm] pass handlers to actions slot * docs(components): [popconfirm] tweak example * chore: tweak * chore: tweak * chore: update test --------- Co-authored-by: btea <2356281422@qq.com>
35 lines
737 B
Vue
35 lines
737 B
Vue
<template>
|
|
<el-popconfirm
|
|
width="220"
|
|
:icon="InfoFilled"
|
|
icon-color="#626AEF"
|
|
title="Are you sure to delete this?"
|
|
@cancel="onCancel"
|
|
>
|
|
<template #reference>
|
|
<el-button>Delete</el-button>
|
|
</template>
|
|
<template #actions="{ confirm, cancel }">
|
|
<el-button size="small" @click="cancel">No!</el-button>
|
|
<el-button
|
|
type="danger"
|
|
size="small"
|
|
:disabled="!clicked"
|
|
@click="confirm"
|
|
>
|
|
Yes?
|
|
</el-button>
|
|
</template>
|
|
</el-popconfirm>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref } from 'vue'
|
|
import { InfoFilled } from '@element-plus/icons-vue'
|
|
|
|
const clicked = ref(false)
|
|
function onCancel() {
|
|
clicked.value = true
|
|
}
|
|
</script>
|