diff --git a/src/views/home/index copy.vue b/src/views/home/index copy.vue new file mode 100644 index 0000000..b88ea81 --- /dev/null +++ b/src/views/home/index copy.vue @@ -0,0 +1,419 @@ + + + + + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index b88ea81..ed2e35a 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,419 +1,7 @@ - - const handleRoute = (route) => router.push(route); - const handleChart = (selector, color, name, data) => { - const chart = echarts.init(document.querySelector(selector)); - const option = { - color: color, - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'shadow', - }, - }, - grid: { - left: '3%', - right: '4%', - bottom: '3%', - containLabel: true, - }, - xAxis: [ - { - type: 'category', - boundaryGap: false, - data: data.map((item) => item.label), - }, - ], - yAxis: [ - { - type: 'value', - }, - ], - series: [ - { - name, - type: 'line', - stack: 'Total', - smooth: true, - lineStyle: { - width: 0, - }, - showSymbol: false, - areaStyle: { - opacity: 0.8, - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { - offset: 0, - color: 'rgb(128, 255, 165)', - }, - { - offset: 1, - color: 'rgb(1, 191, 236)', - }, - ]), - }, - emphasis: { - focus: 'series', - }, - data: data.map((item) => item.value), - }, - ], - }; - chart.setOption(option); - }; - onActivated(async () => { - await store.dispatch('home/load'); - handleChart('.row-5 .chart', '#80FFA5', '访客数量', unref(opts).chart[0].data); - handleChart('.row-6 .chart', '#00DDFF', '订单数量', unref(opts).chart[1].data); - handleChart('.row-7 .chart', '#37A2FF', '销售额', unref(opts).chart[2].data); - }); - - - +