How to use the vant.Toast.fail function in vant

To help you get started, we’ve selected a few vant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ljhhhhhh / h5vue / src / utils / request.js View on Github external
error => {
    console.log('err' + error) // for debug
    Toast.fail({
      message: error.message,
      duration: 1.5 * 1000
    })
    return Promise.reject(error)
  }
)
github KangU4 / BigDataPlatform / mall-shopping-mobile / src / utils / request.js View on Github external
response => {
    const res = response.data

    if (res.errno === 501) {
        Toast.fail('请登录');
        setTimeout(() => {
          window.location = '#/login/'
        }, 1500)
      return Promise.reject('error')
    } else if (res.errno === 502) {
        Toast.fail('网站内部错误,请联系网站维护人员')
      return Promise.reject('error')
    } if (res.errno === 401) {
      Toast.fail('参数不对');
      return Promise.reject('error')
    } if (res.errno === 402) {
      Toast.fail('参数值不对');
      return Promise.reject('error')
    } else if (res.errno !== 0) {
      // 非5xx的错误属于业务错误,留给具体页面处理
      return Promise.reject(response)
    } else {
      return response
    }
  }, error => {
    console.log('err' + error)// for debug
github linlinjava / litemall / litemall-vue / src / utils / request.js View on Github external
const res = response.data

    if (res.errno === 501) {
        Toast.fail('请登录');
        setTimeout(() => {
          window.location = '#/login/'
        }, 1500)
      return Promise.reject('error')
    } else if (res.errno === 502) {
        Toast.fail('网站内部错误,请联系网站维护人员')
      return Promise.reject('error')
    } if (res.errno === 401) {
      Toast.fail('参数不对');
      return Promise.reject('error')
    } if (res.errno === 402) {
      Toast.fail('参数值不对');
      return Promise.reject('error')
    } else if (res.errno !== 0) {
      // 非5xx的错误属于业务错误,留给具体页面处理
      return Promise.reject(response)
    } else {
      return response
    }
  }, error => {
    console.log('err' + error)// for debug
github hanyucd / vue-mall-mobile / mall / src / utils / ajax.js View on Github external
.then(response => {
        if (response.status === 200) {
          if (response.data.code === 200 || !response.data.code) {
            // 请求成功
            resolve(response.data);
          } else {
            // 请求错误
            reject(response.data);
          }
        } else {
          // 服务器错误
          Toast.fail('服务器错误!');
          reject(response.data);
        }
      })
      .catch(error => {
github linlinjava / litemall / litemall-vue / src / views / order / checkout.vue View on Github external
onSubmit() {     
      const {AddressId, CartId, CouponId, UserCouponId} = getLocalStorage('AddressId', 'CartId', 'CouponId', 'UserCouponId');

      if (AddressId === null) {
        Toast.fail('请设置收货地址');
        return;
      }


      this.isDisabled = true;

      orderSubmit({
        addressId: AddressId,
        cartId: CartId,
        couponId: CouponId,
        userCouponId: UserCouponId,
        grouponLinkId: 0,
        grouponRulesId: 0,
        message: this.message
      }).then(res => {
github czero1995 / fancy-store / src / views / cart / Cart.vue View on Github external
async onCutCart(item) {
            if (item.num > 1) {
                let res = await apiCutCart(item.productId, "cut");
                if (res.data.code === 0) {
                    console.log("减少成功");
                    Toast.success("减少成功");
                    item.num--;
                } else {
                    Toast.fail(res.data.msg);
                }
                this.onCalAllCoach();
            }
        },
        onCalAllCoach() {
github linlinjava / litemall / litemall-vue / src / plugins / axios.js View on Github external
break;
        case 404:
          break;
        case 740: {
          Toast.fail('优惠券已经领取过');
          break;
        }
        case 501: {
          Toast.fail('请登录');
          setTimeout(() => {
            window.location = '#/login/'
          }, 1500)
          break;
        }
        default:
          Toast.fail(res.data.errmsg)
      }
      return Promise.reject(res);
    }
    return res;
  },
  error => {
github linlinjava / litemall / litemall-vue / src / plugins / axios.js View on Github external
const flag = Array.isArray(res.data.data) && res.data.data.length;
          Dialog.alert({
            message: flag ? res.data.data[0].message : res.data.message
          });
          break;
        }
        case 401:
          break;
        case 404:
          break;
        case 740: {
          Toast.fail('优惠券已经领取过');
          break;
        }
        case 501: {
          Toast.fail('请登录');
          setTimeout(() => {
            window.location = '#/login/'
          }, 1500)
          break;
        }
        default:
          Toast.fail(res.data.errmsg)
      }
      return Promise.reject(res);
    }
    return res;
  },
  error => {
github 122177638 / vue-apiCloud-model-mobile / src / server / axios.js View on Github external
error => {
    Toast.fail("加载超时");
    return Promise.reject(error);
  }
);
github linlinjava / litemall / litemall-vue / src / views / login / login.vue View on Github external
}).catch(error => {
        Toast.fail(error.data.errmsg);
      });
    },