diff --git a/web/src/ui/dialogs.ts b/web/src/ui/dialogs.ts index b1e795f..9f45aea 100644 --- a/web/src/ui/dialogs.ts +++ b/web/src/ui/dialogs.ts @@ -1,4 +1,4 @@ -import { w2alert, w2confirm, w2popup } from "../vendor/w2ui"; +import { w2confirm, w2popup, w2utils } from "../vendor/w2ui"; type PopupActionEvent = { detail: { @@ -10,7 +10,11 @@ type PopupActionEvent = { }; export function notify(message: string, title = "提示") { - w2alert(message, title); + w2utils.alert({ + box: "body", + title, + text: message + }); } export function notifyError(error: unknown) { diff --git a/web/src/vendor/w2ui.ts b/web/src/vendor/w2ui.ts index cf59f96..f34df80 100644 --- a/web/src/vendor/w2ui.ts +++ b/web/src/vendor/w2ui.ts @@ -21,6 +21,14 @@ type W2Popup = { close(): void; }; +type W2Utils = { + alert(options: { + box?: string | HTMLElement; + title?: string; + text?: string; + }): unknown; +}; + type W2LayoutOptions = { name: string; padding?: number; @@ -45,6 +53,7 @@ const local = w2uiLocal as Record; export const w2popup = local.w2popup as W2Popup; export const w2layout = local.w2layout as new (options: W2LayoutOptions) => W2Layout; export const w2ui = local.w2ui as Record void } | undefined>; +export const w2utils = local.w2utils as W2Utils; export const w2alert = local.w2alert as (message: string, title?: string) => unknown; export const w2confirm = local.w2confirm as ( message: string | { msg: string; title?: string; yes?: string; no?: string },