SendVerifyCode.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. export default {
  11. data() {
  12. return {
  13. disabled: false,
  14. text: "获取验证码"
  15. };
  16. },
  17. methods: {
  18. sendCode() {
  19. if (this.disabled) return;
  20. this.disabled = true;
  21. let n = 60;
  22. this.text = "剩余 " + n + "s";
  23. const run = setInterval(() => {
  24. n = n - 1;
  25. if (n < 0) {
  26. clearInterval(run);
  27. }
  28. this.text = "剩余 " + n + "s";
  29. if (this.text < "剩余 " + 0 + "s") {
  30. this.disabled = false;
  31. this.text = "重新获取";
  32. }
  33. }, 1000);
  34. }
  35. }
  36. };