小程序 showLoading与showToast不能共存使用教程
loading与toast一般不能同时引用,所以一般先把hideloading了,再执行showtoast
之前把hideloading加到了complete中,所以toast就一直出问题
wx.showLoading({
title: '加载中',
})
wx.request({
url: '',
header: {
"thirdSessionKey": app.globalData.thirdSessionKey
},
data: {
},
success(res) {
wx.hideLoading() // loading与toast一般不能同时引用,所以一般先把hideloading了,再执行showtoast
wx.showToast({
title: res.data.message,
icon: "none",
duration: 5000
})
},
fail(){
},
complete(){
// 执行在success和fail之后
}
})