export default {
_toast(param, fn) {
uni.showToast({
…param
})
setTimeout(() => {
typeof fn === ‘function’ && fn()
}, parseInt((param.duration || 1500) * 0.9))
},
toast(title, fn) {
this._toast({
title,
duration: 2000,
icon: ‘none’
},fn)
},
successToast(title, fn) {
this._toast({
title,
duration: 2000,
icon: ‘success’
}, fn)
},
loadingToast(title, fn) {
this._toast({
title,
duration: 2000,
icon: ‘loading’
}, fn)
}
}
uni-app封装统一的加载成功以及回调成功函数
最新推荐文章于 2025-06-08 18:58:38 发布