diff --git a/src/views/common/board-part-table.vue b/src/views/common/board-part-table.vue index c1477c9..c09e621 100644 --- a/src/views/common/board-part-table.vue +++ b/src/views/common/board-part-table.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2022-03-07 15:31:13 * @LastEditors: zwq - * @LastEditTime: 2022-07-01 16:58:50 + * @LastEditTime: 2022-07-05 16:11:42 * @Description: --> diff --git a/src/views/common/board-part.vue b/src/views/common/board-part.vue index f945c19..81a3d7d 100644 --- a/src/views/common/board-part.vue +++ b/src/views/common/board-part.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2022-03-07 15:31:13 * @LastEditors: zwq - * @LastEditTime: 2022-07-01 16:58:00 + * @LastEditTime: 2022-07-05 16:18:48 * @Description: --> @@ -63,17 +63,9 @@ import partTable from './board-part-table.vue' export default { components: {partTable}, props: { - tableData: { - type: Array, - default: () => [] - }, - countdown: { + wbData: { type: Object, - default: () => ({ - 'hours': 1, - 'minutes': 10, - 'seconds': 0 - }) + default: () => {} }, imgUrl: { type: String, @@ -82,91 +74,21 @@ export default { }, data () { return { - hours: 1, - minutes: 12, - seconds: 0 } }, created () { - this.hours = this.countdown.hours - this.minutes = this.countdown.minutes - this.seconds = this.countdown.seconds }, mounted () { - this.add() - }, - watch: { - // 监听数值变化 - second: { - handler (newVal) { - this.num(newVal) - } - }, - minute: { - handler (newVal) { - this.num(newVal) - } - }, - hour: { - handler (newVal) { - this.num(newVal) - } - } - }, - computed: { - // 初始化数据 - second () { - return this.num(this.seconds) - }, - minute () { - return this.num(this.minutes) - }, - hour () { - return this.num(this.hours) - } }, methods: { - num (n) { - return n < 10 ? '0' + n : '' + n - }, - // 倒计时函数 - add () { - let time = window.setInterval(() => { - if (this.hours !== 0 && this.minutes === 0 && this.seconds === 0) { - this.hours -= 1 - this.minutes = 59 - this.seconds = 59 - } else if ( - this.hours === 0 && - this.minutes !== 0 && - this.seconds === 0 - ) { - this.minutes -= 1 - this.seconds = 59 - } else if ( - this.hours === 0 && - this.minutes === 0 && - this.seconds === 0 - ) { - this.seconds = 0 - window.clearInterval(time) - } else if ( - this.hours !== 0 && - this.minutes !== 0 && - this.seconds === 0 - ) { - this.minutes -= 1 - this.seconds = 59 - } else { - this.seconds -= 1 - } - }, 1000) - } } } diff --git a/src/views/main.vue b/src/views/main.vue index b47bcf7..52545b7 100644 --- a/src/views/main.vue +++ b/src/views/main.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-15 08:20:28 * @LastEditors: zwq - * @LastEditTime: 2022-03-18 14:48:46 + * @LastEditTime: 2022-07-05 15:46:53 * @Description: -->