hy20160705 commented on issue #10057: 引入echarts-gl之后导致代码报错 URL: https://github.com/apache/incubator-echarts/issues/10057#issuecomment-470080410 引入echarts-gl之后 vue的beforeCreate钩子函数都没有进去 代码: <template> <div id="proStableRateChart" class="chart"></div> </template> <script> import {path, util} from '@/libs/common' // import * as echarts from 'echarts' import 'echarts-gl' export default { name: 'production-stability-rate-chart', data () { return { proStableRateOption: {}, proStableRateChart: null } }, mounted () { this.initChart() }, create(){ }, beforeCreate(){ }, beforeDestroy () { this.proStableRateOption = {} this.proStableRateChart.clear() }, methods: { initChart () { this.proStableRateOption = { tooltip: {}, visualMap: { max: 5000, inRange: { color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'] }, textStyle: { color: '#EBEDEF' } }, xAxis3D: { name: '时间', nameGap: 60, nameTextStyle: { color: '#EBEDEF', fontSize: '12px', }, type: 'category', data: [], axisLabel: { color: '#EBEDEF', fontSize: '12px' }, axisLine: { lineStyle: { color: '#b8e3ff' } }, }, yAxis3D: { name: '产线', nameLocation: "end", nameGap: 50, nameTextStyle: { color: '#EBEDEF', fontSize: '12px', }, type: 'category', data: [], axisLabel: { color: '#EBEDEF', fontSize: '12px' }, axisLine: { lineStyle: { color: '#b8e3ff' } }, }, zAxis3D: { name: '产值', nameLocation: "start", nameGap: 100, nameTextStyle: { color: '#EBEDEF', fontSize: '12px', }, type: 'value', axisLabel: { color: '#EBEDEF', fontSize: '12px' }, axisLine: { lineStyle: { color: '#b8e3ff' } }, }, grid3D: { boxWidth: 400, boxDepth: 200, boxHeight: 200, viewControl: { projection: 'perspective', distance: 401 }, light: { main: { intensity: 1.2, shadow: true }, ambient: { intensity: 0.3 } } }, series: { type: 'bar3D', data: [], shading: 'lambert', label: { textStyle: { fontSize: 16, borderWidth: 1 } }, emphasis: { label: { textStyle: { fontSize: 20, color: '#900' } }, itemStyle: { color: '#900' } } } } this.proStableRateChart = echarts.init(document.getElementById('proStableRateChart')) this.getProLastOneYearByLineAndMonth() window.addEventListener('resize', () => { this.proStableRateChart.resize() }) }, getProLastOneYearByLineAndMonth () { s } } } </script> <style scoped> .chart { width: 100%; height: 250px; } </style>
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
