// @ts-ignore import * as echarts from '../../../../../../components/ec-canvas/echarts.js' import {getVoiceActiveA,getVoiceActive} from '../../../../utils/echarts' Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { ecA: { lazyLoad: true }, ecB: { lazyLoad: true }, }, lifetimes: { attached() { // @ts-ignore this.ecComponentA = this.selectComponent('#mychart-dom-bar') // @ts-ignore this.ecComponentB = this.selectComponent('#mychart-dom-pie') this.initA() this.initB() } }, methods: { // 点击按钮后初始化图表 initA () { // @ts-ignore this.ecComponentA.init((canvas: any, width: any, height: any) => { const chart = echarts.init(canvas, null, { width: width, height: height }) getVoiceActiveA(chart) return chart }) }, initB () { // @ts-ignore this.ecComponentB.init((canvas: any, width: any, height: any) => { const chart = echarts.init(canvas, null, { width: width, height: height }) getVoiceActive(chart) return chart }) }, } })