// 发送请求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用的同一个框子底层,解决办法还是用异步执行顺序来