Vant Toast loading加载使用

在这里插入图片描述

methods: {
    
    
 // 提交表单
 onSubmit(value) {
    
    
     const toast = vant.Toast.loading({
    
    
         duration: 0, // 持续展示 toast
         forbidClick: true,
         message: "加载中..."
     });
     axios.post("http://127.0.0.1:8010/test").then(function (resp) {
    
    
         let res = resp.data;
         if (res.code == 200) {
    
    
             console.log("成功-清除加载");
             vant.Toast.clear();
         } else {
    
    
             _this.loadBtn = false;
             vant.Toast.fail(res.msg);
         }
     }).catch(function (error) {
    
    
         // 请求发送失败
         console.log("请求失败-清除加载");
         vant.Toast.clear();  // 清除加载
         vant.Toast.fail('网络不稳定');
     });
  }
}

猜你喜欢

转载自blog.csdn.net/IT_iosers/article/details/118107675
今日推荐