微信小程序报错 {“errMsg“: “hideLoading:fail toast can‘t be found“}

{"errMsg": "hideLoading:fail toast can't be found"}

原因

wx.showToast()  和  wx.showLoading()

都是用 wx.hideLoading()来隐藏的

所以一起用的话就会报错

解决办法

1、不要一起用

2、 wx.showToast 在 wx.hideLoading complete 完成之后再用

wx.hideLoading({
  success: (response) => {
    // 成功
  },
  complete: response => {
    wx.showToast({
      title: '成功',
      icon:"none"
    })
  }
})

猜你喜欢

转载自blog.csdn.net/GrootBaby/article/details/129177285