How to use vant - 10 common examples

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 MixinNetwork / supergroup.mixin.one / web / src / pages / WxPay.vue View on Github external
(res) => {
          console.log(res)
          // alert(JSON.stringify(res))
          if (res.err_msg == "get_brand_wcpay_request:ok") {
            Toast(this.$t('wxpay.succ_toast'))
            this.$router.push('/wxpay/done')
          } else if (res.err_msg == "get_brand_wcpay_request:fail"){
            Toast(this.$t('wxpay.error_toast', {msg: res.err_msg}))
          }
          this.loading = false
        }
      );
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 YunaiV / onemall / mobile-web / src / page / pay / index.vue View on Github external
pingpp.createPayment(data.invokeResponse, function(result, err) {
            if (result === 'success') {
              Dialog.alert({
                title: '系统提示',
                message: '支付成功',
                beforeClose: function (action, done) {
                  // 关闭弹窗
                  done();
                  // 跳转到我的优惠劵
                  that.$router.push(decodeURI(that.returnUrl));
                }
              });
            } else {
              // console.log(err.msg);
              // console.log(err.extra);
              Dialog.alert({
                title: '系统提示',
                message: '支付失败:' + err.msg,
              });
github KangU4 / BigDataPlatform / mall-shopping-mobile / src / utils / request.js View on Github external
}, error => {
    console.log('err' + error)// for debug
    Dialog.alert({
        title: '警告',
        message: '登录连接超时'
      });
    return Promise.reject(error)
  })
github linlinjava / litemall / litemall-vue / src / utils / request.js View on Github external
}, error => {
    console.log('err' + error)// for debug
    Dialog.alert({
        title: '警告',
        message: '登录连接超时'
      });
    return Promise.reject(error)
  })
github hanyucd / vue-mall-mobile / mall / src / pages / Register / index.vue View on Github external
let method = 'post';
        let path = Url.registerApi;
        let params = {
          userName: this.userName,
          passWord: this.passWord
        };
        try {
          this.loading = true; // 开启按钮注册状态
          let res = await registerUser(path, method, params);
          console.log(res)
          // 将 token & 用户名存储到 localStorage 中
          localStorage.setItem('token', res.token);
          localStorage.setItem('userName', res.userName);
          // 注册成功提示
          Toast.success({
            duration: 1000,
            message: res.message
          });
          // 1.5 秒后跳转到首页
          let timer = setTimeout(() => {
            this.$router.push({ name: 'Home' }); // 注册成功跳转到首页
            clearTimeout(timer); // 清除定时器
          }, 1500);
        } catch (error) {
          console.log(error)
          this.$toast.fail('注册失败');
        } finally {
          this.loading = false;
        }
      }
    }
github czero1995 / fancy-store / src / views / category / Category.vue View on Github external
}
            ]
        };
    },
    data() {
        return {
            menuList: [],
            categoryList: [],
            categoryContent: [],
            pageNum: 0,
            type: ""
        };
    },
    mixins: [dataMixin],
    components: {
        [NavBar.name]: NavBar,
        [Tab.name]: Tab,
        [Tabs.name]: Tabs,
        [Toast.name]: Toast,
        [Icon.name]: Icon
    },
    computed: {},

    mounted() {
        this.getMenuList();
        // this.getCategoryList();
    },
    methods: {
        async getMenuList() {
            let res = await apiGetCategoryMenu();
            this.menuList = res.data.data.slice(1);
            console.log("menuList: ", this.menuList);
github geekape / applet-h5-shop / mpvue / wap / src / pages / shop / cart / index.vue View on Github external
var that = this;
      var lists = this.carts;
      var cartIds = [];
      var left = [];
      for (var i = 0; i < lists.length; i++) {
        if (lists[i].isCheck) {
          cartIds.push(lists[i].id);
        } else {
          left.push(lists[i]);
        }
      }
      cartIds = cartIds.join();
      if (cartIds == "") {
        Toast("请选择要删除的购物车物品");
      } else {
        Dialog.confirm({
          title: "提示",
          message: "确认删除?"
        })
          .then(() => {
            // on confirm
            post("shop/api/delCart", {
              ids: cartIds,
              PHPSESSID: window.localStorage.getItem("PHPSESSID")
            }).then(res => {
              that.carts = left;
            });
            let delLen = cartIds.split(",").length;
            let num = that.$store.state.cartShopNum;
            let lastCartNum = num - delLen;
            that.$store.commit("getCartShopNum", {
              num: lastCartNum