diff --git a/pages/home/index.vue b/pages/home/index.vue index 68718ae..d0cadb7 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -50,9 +50,8 @@ Blame {{ i18n.TodaySteps }} - + {{ i18n.ReceiveEarnings }} @@ -75,7 +74,8 @@ Blame margin: 'auto 102rpx auto 118rpx', }"> - + {{ i18n.homeMessage }} OK @@ -175,8 +175,8 @@ export default { } }, methods: { - getbanner(){ - const indexBanner=api.indexBanner({'mark':'APP_INDEX'}); + getbanner() { + const indexBanner = api.indexBanner({ 'mark': 'APP_INDEX' }); console.log(indexBanner) }, // 弹出语言选择框 @@ -342,26 +342,18 @@ export default { let myChart export default { mounted() { - console.log(0); - console.log(window); - console.log(typeof window.echarts); // this.initEcharts(); if (typeof window.echarts === 'object') { this.initEcharts() }else if (typeof window.echarts === 'function') { this.initEcharts() } else { - console.log(1); // 动态引入较大类库避免影响页面展示 const script = document.createElement('script'); - console.log(2); // view 层的页面运行在 www 根目录,其相对路径相对于 www 计算 - script.src = './static/echarts.js'; - console.log(3); + script.src = './static/echarts.min.js'; script.onload = this.initEcharts.bind(this); - console.log(4); document.head.appendChild(script); - console.log(5); } }, @@ -371,20 +363,10 @@ export default { }, initEcharts() { - console.log(31); - // let t1=null; this.initChart() - console.log(32); myChart = echarts.init(document.getElementById('chart')) - console.log(33); // 观测更新的数据在 view 层可以直接访问到 myChart.setOption(this.option) - console.log(34); - // clearInterval(t1) - // t1= setInterval(() => { - // console.log(1); - // myChart.setOption(this.option) - // }, 1000); }, updateEcharts(newValue, oldValue, ownerInstance, instance) { // 监听 service 层数据变更 @@ -397,12 +379,6 @@ export default { }) }, initChart() { - // let myChart = echarts.init(this.$refs.chart); - // console.log(document); - // console.log(this.$refs.chart); - // this.myChart = echarts.init(document.getElementById('chart')); - // this.myChart = echarts.init(this.$refs.chart); - // myChart = echarts.init(document.getElementById('chart')) this.option = { title: { text: this.stepsNum, @@ -421,6 +397,7 @@ export default { series: [{ name: '环形饼图', type: 'pie', + roundCap: true, radius: ['48%', '70%'], avoidLabelOverlap: false, label: { @@ -432,7 +409,7 @@ export default { shadowBlur: 30, shadowColor: '#15141F', shadowOffsetX: 'center', - shadowOffsetY: 'center' + shadowOffsetY: 'center', }, data: [{ @@ -452,8 +429,6 @@ export default { } ]), borderRadius: 800, - - } }, { @@ -469,9 +444,9 @@ export default { } // myChart.setOption(this.option, true); - // window.addEventListener('resize', () => { - // myChart.resize(); - // }); + window.addEventListener('resize', () => { + myChart.resize(); + }); } }, watch: { @@ -487,6 +462,7 @@ export default {