From 40571d2337060aefb562afe917a8d0d4e46554ab Mon Sep 17 00:00:00 2001 From: imeepos Date: Tue, 13 Jan 2026 16:13:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Toast=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/Toast.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/ui/Toast.tsx b/components/ui/Toast.tsx index 689017d..e44837e 100644 --- a/components/ui/Toast.tsx +++ b/components/ui/Toast.tsx @@ -65,8 +65,10 @@ const Toast = (function () { // }) let toastTimer: number | null = null - const show = (params?: ShowParams): void => { - const { renderContent, title, duration = 4000, hideBackdrop = true } = params || {} + const show = (params?: ShowParams | string): void => { + // 兼容字符串参数 + const options: ShowParams = typeof params === 'string' ? { title: params } : (params || {}) + const { renderContent, title, duration = 4000, hideBackdrop = true } = options hide() const renderBody = (): ReactNode => {