Commit 5130d47b authored by xhx's avatar xhx

时间框架

parent 9f8c3b01
...@@ -35,7 +35,10 @@ export default Vue.extend({ ...@@ -35,7 +35,10 @@ export default Vue.extend({
methods: { methods: {
getTimes() { getTimes() {
const r = +this.time - Date.now() const r = +this.time - Date.now()
if (r < 0) throw Error('已超出截至时间') if (r < 0) {
if (this.timer) clearInterval(this.timer)
throw Error('已超出截至时间')
}
const day = +parseInt(r / (1000 * 60 * 60 * 24) + '') const day = +parseInt(r / (1000 * 60 * 60 * 24) + '')
this.day = day >= 10 ? day + '' : '0' + day this.day = day >= 10 ? day + '' : '0' + day
const hour = +parseInt(r / (1000 * 60 * 60) % 24 + '') const hour = +parseInt(r / (1000 * 60 * 60) % 24 + '')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment