From a0827061b3d78e7da6eef68188fa87c94fd3fee6 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 16 Dec 2020 23:13:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=A5=E6=95=91=E6=97=B6=E9=95=BF=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=9B=BE=E6=AF=8F10=E7=A7=92=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- src/components/Duration/Duration.vue | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 8336979..1636a2c 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + <%= htmlWebpackPlugin.options.title %> diff --git a/src/components/Duration/Duration.vue b/src/components/Duration/Duration.vue index 65ac701..3f50d65 100644 --- a/src/components/Duration/Duration.vue +++ b/src/components/Duration/Duration.vue @@ -14,10 +14,14 @@ export default { // msg: 'Welcome to Your Vue.js App', width: '', height: '', + timer: null, }; }, mounted() { this.drawLine(); + this.timer = setInterval(() => { + this.drawLine(); + }, 10000); let wh = window.innerWidth; let hg = window.innerHeight; this.width = wh + 'px'; @@ -32,6 +36,9 @@ export default { })(); }; }, + destroyed() { + clearInterval(this.timer); + }, methods: { async drawLine() { // 基于准备好的dom,初始化echarts实例