//延迟跳转
wx.showToast({
title: '成功',
icon: 'success',
duration: 2000,
success:function(){
console.log('haha');
setTimeout(function () {
//要延时执行的代码
wx.switchTab({
url: '../user/user'
})
}, 2000) //延迟时间
}
})
//解决showToast一闪而过的问题
setTimeout(function(){
wx.showToast({
title: '当前没有可插入的活动链接',
icon: 'none',
duration: 2000
})
}, 100)
本文介绍了在微信小程序中实现延迟跳转的方法,并提供了解决showToast显示时间过短问题的技巧。通过使用setTimeout结合wx.showToast和wx.switchTab,可以实现更友好的用户体验。
1172

被折叠的 条评论
为什么被折叠?



