16 lines
383 B
TypeScript
16 lines
383 B
TypeScript
import { ElMessageBox, type ElMessageBoxOptions } from 'element-plus'
|
|
|
|
export async function confirmAction(
|
|
message: string,
|
|
title: string,
|
|
options?: ElMessageBoxOptions,
|
|
): Promise<boolean> {
|
|
try {
|
|
await ElMessageBox.confirm(message, title, options)
|
|
return true
|
|
} catch (error) {
|
|
if (error === 'cancel' || error === 'close') return false
|
|
throw error
|
|
}
|
|
}
|