fix: 修复 Toast 支持字符串参数

This commit is contained in:
imeepos 2026-01-13 16:13:21 +08:00
parent 7cf896215c
commit 40571d2337
1 changed files with 4 additions and 2 deletions

View File

@ -65,8 +65,10 @@ const Toast = (function () {
// }) // })
let toastTimer: number | null = null let toastTimer: number | null = null
const show = (params?: ShowParams): void => { const show = (params?: ShowParams | string): void => {
const { renderContent, title, duration = 4000, hideBackdrop = true } = params || {} // 兼容字符串参数
const options: ShowParams = typeof params === 'string' ? { title: params } : (params || {})
const { renderContent, title, duration = 4000, hideBackdrop = true } = options
hide() hide()
const renderBody = (): ReactNode => { const renderBody = (): ReactNode => {