mounted() { this.drawLine() }, updated(){ this.drawLine() }, methods: { drawLine(){ let myChart = echarts.init(document.getElementById('myChart')); let dataName = []; let total = 0; this.list.forEach((res) => { dataName.push(res.name); total += parseFloat(res.value); }); myChart.setOption({ title: { zlevel: 0, text: [ '{money|¥}'+'{value|' + total + '}', '{name|总金额}', ].join('\n'), top: 'center', left: '46%', textAlign: 'center', textStyle: { rich: { value: { color: '#303133', fontSize: 22, fontWeight: 'bold', lineHeight: 40, }, name: { color: '#ccc', fontSize: 16, lineHeight: 18 }, money: { color: '#767676', fontSize: 16, lineHeight: 18 }, }, }, }, color:['#83D587','#4DA1FF','#FFA800','#a249e7'], tooltip: { trigger: 'axis', axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } } }, series: [{ name: '订单数量', type: 'pie', radius: ['80%', '100%'], avoidLabelOverlap: false, hoverAnimation: false, // 取消掉环形图鼠标移上去时自动放大 itemStyle : { //图形外文字上下显示 normal : { label : { show : false }, labelLine : { show : false } }, }, emphasis: { label: { show: false, fontSize: '40', fontWeight: 'bold' } }, labelLine: { show: false }, data: this.list }] }); }, },