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()}` + }) + } } }