feat: utils-toast 添加 mask 属性以支持透明蒙层选项
This commit is contained in:
@@ -12,6 +12,11 @@ interface ToastOptions {
|
|||||||
position?: 'top' | 'middle' | 'bottom'
|
position?: 'top' | 'middle' | 'bottom'
|
||||||
icon?: 'success' | 'error' | 'none' | 'loading' | 'fail' | 'exception'
|
icon?: 'success' | 'error' | 'none' | 'loading' | 'fail' | 'exception'
|
||||||
message: string
|
message: string
|
||||||
|
/**
|
||||||
|
* 是否显示透明蒙层,防止触摸穿透
|
||||||
|
* @default true
|
||||||
|
*/
|
||||||
|
mask?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showToast(options: ToastOptions | string) {
|
export function showToast(options: ToastOptions | string) {
|
||||||
@@ -20,6 +25,7 @@ export function showToast(options: ToastOptions | string) {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
position: 'middle',
|
position: 'middle',
|
||||||
message: '',
|
message: '',
|
||||||
|
mask: true,
|
||||||
}
|
}
|
||||||
const mergedOptions
|
const mergedOptions
|
||||||
= typeof options === 'string'
|
= typeof options === 'string'
|
||||||
@@ -49,7 +55,7 @@ export function showToast(options: ToastOptions | string) {
|
|||||||
duration: mergedOptions.duration,
|
duration: mergedOptions.duration,
|
||||||
position: positionMap[mergedOptions.position],
|
position: positionMap[mergedOptions.position],
|
||||||
icon: mergedOptions.icon || iconMap[mergedOptions.type],
|
icon: mergedOptions.icon || iconMap[mergedOptions.type],
|
||||||
mask: true,
|
mask: mergedOptions.mask,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user