1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > wx.showToast() 在真机中一闪而过

wx.showToast() 在真机中一闪而过

时间:2024-06-30 18:40:29

相关推荐

wx.showToast() 在真机中一闪而过

// 发送请求uni.request({// 请求类型method: type,// 请求地址url: baseApi + url,// 请求参数data: data,// 请求头配置header: header,// 数据格式dataType: 'json',}).then((response) => {// 如果请求成功// 关闭加载loadingsetTimeout(function () {uni.hideLoading();}, 0);let [error, res] = response;resolve(res.data);}).catch(error => {// 如果请求错误,关闭加载loadingsetTimeout(function () {uni.hideLoading();}, 0);let [err, res] = error;reject(err)})});解决办法:setTimeout(() => {wx.showToast({icon: 'none',title: `${retult.msg}`,duration: 3000})}, 100)

为啥真机中一闪而过 因为uni.hideLoading();和wx.showToast用的同一个框子底层,解决办法还是用异步执行顺序来

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。