forms/input/CInputPhoneCode.vue
@@ -50,7 +50,7 @@ }, // 发送请求,通知后端给手机发验证码 onCallPhoneCode: Function, // 刷新cd 重新刷新回60秒通知父组件更新图片地址 // 刷新cd后,通知父组件更新图片地址 onRefreshCD: { type: Function, default: () => () => null, @@ -60,6 +60,7 @@ return { cd: 60, holding: false, timer: null, }; }, computed: { @@ -79,7 +80,8 @@ const startCD = () => { this.holding = true; this.cd = 60; setInterval(() => { clearInterval(this.timer); this.timer = setInterval(() => { this.cd -= 1; if (this.cd === 0) { this.holding = false; @@ -97,6 +99,10 @@ }); } }, // 重置holding $resetHolding() { this.holding = false; }, }, }; </script>