vant增加全局遮罩层并且带有loading加载中

2022-01-20  本文已影响0人  jesse28

参考文章:https://www.cnblogs.com/missile/p/12706118.html
methods方法中先引入这两个方法

   showloading() {
      var title = "加载中···";
      this.$showLoading({
        title: title,
      });
    },
    hideloading() {
      this.$cancelLoading();
    },

然后在上传方法中调用这两个方法

 apiFileJavaUpload("caseSimpleFile", 0, { file: e.files })
                .then((res) => {
                  self.showloading();
                  if (res.statusCode == 200) {
                    console.log("上传照片", res);
                    self.hideloading();
                  }
                  if (window.plus) {
                    plus.nativeUI.closeWaiting();
                  }
                  let value = res.resMap.fileIdList;
                  self.$emit("responseFun", value);
                })
                .catch(() => {
                  if (window.plus) {
                    plus.nativeUI.closeWaiting();
                  }
                });
            }
上一篇 下一篇

猜你喜欢

热点阅读