定时器 60s 后"/>
定时器 60s 后
<template><div><button v-show="show" @click="getCode" class="getCode">提交答案</button><span v-show="!show" class="count">{{count}}s后进入下一题</span></div>
</template><script>
export default {data() {return {show: true,count: "",timer: null};},mounted() {},methods: {getCode() {const tim_es = 5;if (!this.timer) {this.count = tim_es;this.show = false;this.timer = setInterval(() => {if (this.count > 0 && this.count <= tim_es) {this.count--;} else {this.show = true;clearInterval(this.timer);this.timer = null;}}, 1000);}}},components: {}
};
</script><style lang='scss' scoped>
.home {width: 100%;height: 100%;}
</style>
更多推荐
定时器 60s 后
发布评论