微信小程序toast在真机上闪现

调用showToast:
wx.showToast({
title: '保存成功',
icon: 'success',
duration:2000
})
在开发者工具上时正常,在真机上测试时发现toast一闪而过,解决方法:套一个定时器
setTimeout(()=>{
wx.showToast({
title: '保存成功',
icon: 'success',
duration:2000
})
},200)

共有 0 条评论