How to use the vant.Dialog.confirm 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 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
github czero1995 / fancy-store / src / views / order / OrderWait.vue View on Github external
onOrder() {
            if (!this.addressInfo.name) {
                return Toast(this.$t("m.strategies.address"));
            }
            Dialog.confirm({
                message: this.$t("m.order.orderConfirm")
            })
                .then(() => {
                    this.addOrder("payed");
                    // on confirm
                })
                .catch(() => {
                    // on cancel
                    this.addOrder("paying");
                });
        },
        async onDone() {
github Geek-James / ddBuy / src / views / mine / Children / MyVip.vue View on Github external
getCoupons () {
      Dialog.confirm({
        message: '开通绿卡,立享此券',
        confirmButtonText: "开卡领券",
        confirmButtonColor: '#60b86a'
      }).then(() => {
        // 跳转到开通会员界面
        this.$router.push({ name: 'vipPay' });
      }).catch(() => {
        // on cancel
      });
    },
    // 开通绿卡支付
github Geek-James / ddBuy / src / views / mine / Children / UserCenter.vue View on Github external
logOut () {
      Dialog.confirm({
        message: this.$t('mine.loginInfo')
      }).then(() => {
        // on confirm
        this.LOGIN_OUT();
        Toast({
          message: this.$t('mine.infoSuccess'),
          duration: 800
        });
        this.$router.back();
      }).catch(() => {
        // on cancel
      });
    }
  }
github Geek-James / ddBuy / src / views / cart / Cart.vue View on Github external
reduceGoods (goodsID, goodsNum) {
      if (goodsNum > 1) {
        // 3.1 通过goodsID减少商品
        this.REDUCE_GOODS({
          goodsID
        });
      } else if (goodsNum === 1) {
        Dialog.confirm({
          title: '温馨提示',
          message: '确定删除该商品吗?'
        }).then(() => {
          // on confirm 确认删除
          this.REDUCE_GOODS({ goodsID });
        }).catch(() => {
          // on cancel
        });
      }
    },
    // 4.增加商品数量 保证传递数据和 mutations 一致
github suoyuesmile / vue-mobile-components / src / views / Home.vue View on Github external
showDialog() {
      Dialog.confirm({
        title: '标题',
        message: '弹窗内容'
      })
        .then(() => {
          // on confirm
        })
        .catch(() => {
          // on cancel
        })
    },
    showCustomDialog() {
github YunaiV / onemall / mobile-web / src / config / request.js View on Github external
//     type: 'warning'
      //   }).then(() => {
      //     store.dispatch('FedLogOut').then(() => {
      //       location.reload() // 为了重新实例化vue-router对象 避免bug
      //     })
      //   })
      // }

      // TODO token 过期
      // TODO 需要拿 refresh token 置换
      if (code === 1002001011 // 访问令牌不存在
          || code === 1002001013 // 访问令牌已失效
          || code === 1002001017 // 刷新令牌不存在
          || code === 1002001018 // 刷新令牌已过期
          || code === 1002001019) {  // 刷新令牌已失效
        Dialog.confirm({
          title: '系统提示',
          message: res.message,
          confirmButtonText: '重新登陆',
          beforeClose: function (action, done) {
            done();
            if (action === 'confirm') {
              // debugger;
              // this.$router.push({ path: '/login' })
              // TODO 跳转到登陆页.不是很优雅
              location.replace('/#login');
              location.reload();
            }
          }
        });
      } else if (code === 1002001012) { // 访问令牌已过期
        return refreshToken(response);
github kuaifengle / koa2-mysql-vue-vant / spaApp / src / views / index / index.vue View on Github external
signOut () {
      Dialog.confirm({
        title: '登出',
        message: '确定要登出吗?'
      }).then(() => {
        cookie.remove('assent_token')
        this.isSignIn = false
        this.Toast('你已登出!')
      }).catch(() => {
        this.Toast('你已取消操作!')
      });
    }
  }
github czero1995 / fancy-store / src / views / order / Order.vue View on Github external
onRemove(id, index) {
            Dialog.confirm({
                message: this.$t("m.message.deleteSure")
            }).then(() => {
                this.sureRemove(id, index);
            });
        },
github czero1995 / fancy-store / src / views / address / AddAddress.vue View on Github external
onDelete() {
            Dialog.confirm({
                message: this.$t("message.deleteSure")
            }).then(() => {
                this.sureDelete();
            });
        },
        onBackOther() {