fix: 修复 Toast 支持字符串参数
This commit is contained in:
parent
7cf896215c
commit
40571d2337
|
|
@ -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 => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue