message修改

This commit is contained in:
Ls
2026-04-28 11:22:27 +08:00
parent 2c437fe553
commit 21a9d57d0a

View File

@@ -3,23 +3,20 @@
*/
export class MessageExtend {
// 消息通知
static Notify(type: 'primary' | 'success' | 'danger' | 'warning', message: any) {
static Notify(message: any, type?: 'primary' | 'success' | 'danger' | 'warning') {
showNotify({ type, message })
}
// 提示弹窗
static Dialog(
title: string,
message: string,
theme: 'round-button' | 'default',
onConfirm?: () => void,
onCancel?: () => void,
confirmButtonText: string = '确认',
) {
static ShowDialog(message: string, title?: string) {
showDialog({ title: title, message: message })
}
// 确认提示弹窗
static Dialog(title: string, message: string, onConfirm?: () => void, onCancel?: () => void, confirmButtonText?: string) {
showConfirmDialog({
title: title,
message: message,
theme: theme || 'default',
confirmButtonText: confirmButtonText || '确认',
})
.then(() => {
@@ -31,7 +28,7 @@ export class MessageExtend {
}
// 成功失败默认提示
static ShowToast(type: 'success' | 'fail' | 'default', text: any) {
static ShowToast(text: any, type?: 'success' | 'fail' | 'default') {
if (type == 'success') {
showSuccessToast(text)
} else if (type == 'fail') {
@@ -50,7 +47,7 @@ export class MessageExtend {
}
// 多条消息通知(堆叠展示)
static NotifyList(type: 'primary' | 'success' | 'danger' | 'warning', messages: string[], duration: number = 3000) {
static NotifyList(messages: string[], type: 'primary' | 'success' | 'danger' | 'warning', duration: number = 3000) {
if (typeof window === 'undefined') return
if (!messages || messages.length === 0) return