From 112b22be69948a1a9706e7cdc90e753055128d0b Mon Sep 17 00:00:00 2001 From: Gao xiaosong <704041637@qq.com> Date: Sun, 20 Jun 2021 00:39:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=92=E6=9D=80=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=80=92=E8=AE=A1=E6=97=B6=E6=98=BE=E7=A4=BA0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/CountDown.vue | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/components/CountDown.vue b/components/CountDown.vue index 2a235db..cec9316 100644 --- a/components/CountDown.vue +++ b/components/CountDown.vue @@ -42,16 +42,16 @@ export default { default: true, }, }, - data: function () { + data: function() { return { - time: null, + time: this.datatime, day: '00', hour: '00', minute: '00', second: '00', } }, - created: function () { + created: function() { this.show_time() }, watch: { @@ -61,25 +61,22 @@ export default { this.show_time() }, }, - mounted: function () {}, + mounted: function() {}, methods: { - show_time: function () { + show_time: function() { let that = this - - if (parseInt(this.time).length == 13) { + if (this.time.toString().length == 13) { // 毫秒级 console.log('毫秒') this.time = this.time / 1000 - } else if (parseInt(this.time).length == 10) { + } else if (this.time.toString().length == 10) { console.log('秒') // 秒级 } else { // 时间 console.log('时间') - console.log(this.time) this.time = Date.parse(this.time) / 1000 } - console.log(that.time) function runTime() { //时间函数