32 lines
702 B
TypeScript
32 lines
702 B
TypeScript
import { Modal } from '@arco-design/web-vue';
|
|
|
|
interface ConfirmOptions {
|
|
content: string;
|
|
title?: string;
|
|
onOk?: () => void | Promise<void>;
|
|
onCancel?: () => void | Promise<void>;
|
|
okText?: string;
|
|
cancelText?: string;
|
|
}
|
|
|
|
/**
|
|
* 全局确认对话框工具函数
|
|
* @param options 配置项
|
|
*/
|
|
export const baseConfirm = (options: ConfirmOptions) => {
|
|
const { content, title = '提示', onOk, onCancel, okText = '确定', cancelText = '取消' } = options;
|
|
|
|
return Modal.confirm({
|
|
title,
|
|
content,
|
|
okText,
|
|
cancelText,
|
|
onOk,
|
|
onCancel,
|
|
});
|
|
};
|
|
|
|
// Export as a global function for direct use
|
|
export const $baseConfirm = baseConfirm;
|
|
|
|
export default baseConfirm;
|