From aa0513693390dce3050bd77681886895413f7f06 Mon Sep 17 00:00:00 2001 From: lin-xin <2981207131@qq.com> Date: Mon, 10 Sep 2018 21:04:40 +0800 Subject: [PATCH] =?UTF-8?q?'=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=97=A5=E6=9C=9F'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/page/Dashboard.vue | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/page/Dashboard.vue b/src/components/page/Dashboard.vue index 045376b..61eff64 100644 --- a/src/components/page/Dashboard.vue +++ b/src/components/page/Dashboard.vue @@ -18,13 +18,13 @@ 语言详情 Vue - + JavaScript - + CSS - + HTML - + @@ -92,12 +92,12 @@ - + - + @@ -136,7 +136,7 @@ status: true, } ], - data1: [{ + data: [{ name: '2018/09/04', value: 1083 }, @@ -201,6 +201,7 @@ this.$refs.bar.renderChart(); this.$refs.line.renderChart(); }) + this.changeDate(); }, watch: { collapse(){ @@ -209,6 +210,15 @@ this.$refs.line.renderChart(); }, 300); } + }, + methods: { + changeDate(){ + const now = new Date().getTime(); + this.data.forEach((item, index) => { + const date = new Date(now - (6 - index) * 86400000); + item.name = `${date.getFullYear()}/${date.getMonth()+1}/${date.getDate()}` + }) + } } }