ZBLOG

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

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

  1. <button type="primary" class="data-v-723b7266" @click="showConfirmDialog">充值</button>
  1. methods: {
  2. showConfirmDialog() {
  3. const self = this;
  4. uni.showModal({
  5. title: '确认充值',
  6. content: '确定要进行充值吗?',
  7. success(res) {
  8. if (res.confirm) {
  9. // 用户点击确定,执行充值操作
  10. self.onResetPass();
  11. } else if (res.cancel) {
  12. // 用户点击取消,不进行充值操作
  13. console.log('用户点击取消');
  14. }
  15. }
  16. });
  17. },
  18. onResetPass() {
  19. const table = uni.getStorageSync("nowTable");
  20. if (this.newMoney <= 0) {
  21. this.$utils.msg('请输入正确的充值数目');
  22. return;
  23. }
  24. this.user.newMoney = parseFloat(this.user.newMoney) + parseFloat(this.newMoney);
  25. this.$api.update(table, this.user).then((res) => {
  26. this.changeSuccess = !this.changeSuccess;
  27. });
  28. },
  29. // 其他页面逻辑...
  30. }

在上述示例中,我们使用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

注册

已经有帐号?