47 lines
1010 B
TypeScript
47 lines
1010 B
TypeScript
// eslint-disable-next-line import/prefer-default-export
|
|
import { Modal } from '@arco-design/web-vue';
|
|
import { RenderContent } from '@arco-design/web-vue/es/_utils/types';
|
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
export function $baseConfirm({
|
|
content,
|
|
title,
|
|
onOk,
|
|
onCancel,
|
|
confirmButtonText = '确定',
|
|
cancelButtonText = '取消',
|
|
...args
|
|
}: {
|
|
content: string | RenderContent;
|
|
title?: string;
|
|
onOk?: () => void;
|
|
onCancel?: () => void;
|
|
confirmButtonText?: string;
|
|
cancelButtonText?: string;
|
|
}) {
|
|
Modal.warning({
|
|
title: title || '温馨提示',
|
|
content,
|
|
titleAlign: 'start',
|
|
width: 420,
|
|
bodyStyle: {
|
|
padding: 24,
|
|
},
|
|
hideCancel: false,
|
|
maskClosable: false,
|
|
okText: confirmButtonText,
|
|
cancelText: cancelButtonText,
|
|
onCancel: () => {
|
|
onCancel?.();
|
|
},
|
|
onBeforeOk: async () => {
|
|
try {
|
|
await onOk?.();
|
|
} catch (e) {
|
|
console.error(e);
|
|
}
|
|
return true;
|
|
},
|
|
});
|
|
}
|