All checks were successful
continuous-integration/drone/push Build is passing
- 解压官方默认主题 default_yfMBA.tar.gz 到 clientarea/hgcloud/ - .gitignore 排除压缩包和临时解压目录 - drone 新增步骤: 同步 hgcloud 到 /clientarea/template/pc/
47 lines
1006 B
JavaScript
47 lines
1006 B
JavaScript
// 父组件执行该组件的countDown() 实现倒计时
|
|
const countDownButton = {
|
|
template: `
|
|
<el-button :class="myClass" v-loading="loading" type="primary" :disabled="!flag">{{ flag? name : num + lang.second_try}}</el-button>
|
|
`,
|
|
data() {
|
|
return {
|
|
num: 60,
|
|
flag: true,
|
|
timer: null,
|
|
};
|
|
},
|
|
props: {
|
|
myClass: {
|
|
type: String,
|
|
default: "count-down-btn",
|
|
},
|
|
name: {
|
|
type: String,
|
|
default: lang.send_code,
|
|
},
|
|
loading: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
},
|
|
created() {},
|
|
methods: {
|
|
countDown() {
|
|
this.flag = false;
|
|
this.num = --this.num;
|
|
this.timer = setInterval(() => {
|
|
if (this.num > 1) {
|
|
this.flag = false;
|
|
this.num = --this.num;
|
|
} else {
|
|
clearInterval(this.timer);
|
|
this.timer = null;
|
|
this.flag = true;
|
|
this.num = 60;
|
|
this.$emit("countend");
|
|
}
|
|
}, 1000);
|
|
},
|
|
},
|
|
};
|