Files
Typed SIGTERM 5f32318377 feat(components): [popconfirm] add actions slot (#17957)
* 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>
2024-08-23 08:29:34 +08:00

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>