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实例