ZBLOG

充值 onResetPass: function onResetPass() {var _this2 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.defau...

根据提供的代码,可以将确认对话框逻辑添加到onResetPass方法中。以下是一个可能的修改示例:

<button type="primary" class="data-v-723b7266" @click="showConfirmDialog">充值</button>
methods: {
  showConfirmDialog() {
    const self = this;
    uni.showModal({
      title: '确认充值',
      content: '确定要进行充值吗?',
      success(res) {
        if (res.confirm) {
          // 用户点击确定,执行充值操作
          self.onResetPass();
        } else if (res.cancel) {
          // 用户点击取消,不进行充值操作
          console.log('用户点击取消');
        }
      }
    });
  },
  onResetPass() {
    const table = uni.getStorageSync("nowTable");
    
    if (this.newMoney <= 0) {
      this.$utils.msg('请输入正确的充值数目');
      return;
    }
    
    this.user.newMoney = parseFloat(this.user.newMoney) + parseFloat(this.newMoney);
    
    this.$api.update(table, this.user).then((res) => {
      this.changeSuccess = !this.changeSuccess;
    });
  },
  // 其他页面逻辑...
}

在上述示例中,我们使用uni-app的uni.showModal()方法来显示一个确认对话框。当用户点击确认时,res.confirmtrue;当用户点击取消时,res.canceltrue

在成功情况下,我们调用了原先的 onResetPass() 方法来执行相应的充值操作。

请注意,在实际项目中,请根据您的具体业务需求和uni-app框架进行相应修改,并确保已正确引入相关依赖库和配置了事件处理函数。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://sdn.0voice.com/?id=3654

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?