整理
This commit is contained in:
44
src/pages/UI-components/AntdV/HAPopconfirm/HAPopconfirm.vue
Normal file
44
src/pages/UI-components/AntdV/HAPopconfirm/HAPopconfirm.vue
Normal file
@ -0,0 +1,44 @@
|
||||
<script setup lang="ts">
|
||||
import type { PopconfirmProps } from 'ant-design-vue';
|
||||
|
||||
import type { HPopconfirmProps } from './types';
|
||||
|
||||
defineOptions({ inheritAttrs: true });
|
||||
|
||||
const props = defineProps<HPopconfirmProps>();
|
||||
|
||||
const _loading = shallowRef(false);
|
||||
const onConfirm: PopconfirmProps['onConfirm'] = async (e) => {
|
||||
if (props.onConfirm) {
|
||||
try {
|
||||
_loading.value = true;
|
||||
await props.onConfirm(e);
|
||||
} finally {
|
||||
_loading.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<APopconfirm
|
||||
:align="{
|
||||
targetOffset: [0, 0],
|
||||
}"
|
||||
:arrow-point-at-center="!true"
|
||||
:cancel-button-props="{ disabled: _loading }"
|
||||
:description
|
||||
:disabled="_loading"
|
||||
:on-confirm
|
||||
:title
|
||||
placement="topRight"
|
||||
>
|
||||
<slot></slot>
|
||||
</APopconfirm>
|
||||
</template>
|
||||
|
||||
<style lang="less">
|
||||
[class^='ant-'] .anticon svg {
|
||||
vertical-align: unset; /* baseline */
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user