自学内容网 自学内容网

微信小程序showLoading ,showToast ,hideLoading连续调用出现showLoading 不关闭的情况记录

       

          wx.showLoading({
            title: "操作中",
            mask: true,
          });
          api()
            .then(() => {
                wx.showToast({
                  title: "操作成功",
                  icon: "none",
                });
            })
            .finally(() => {
              wx.hideLoading();
            });

类似的代码偶尔会出现showLoading不关闭的现象, 这种情况下的解决方法就是 使用定期器包裹showToast可以解决

              setTimeout(() => {
                wx.showToast({
                  title: "操作成功",
                  icon: "none",
                });
              }, 50);


原文地址:https://blog.csdn.net/qq_45797421/article/details/142566768

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!