// @ts-ignore import * as echarts from '../../../../../../components/ec-canvas/echarts.js' import {PeopleChart2} from '../../../../utils/echarts' Component({ /** * 组件的属性列表 */ properties: { pepopleList:{ type:Object }, peopleLeft:{ type:Array }, peopleright:{ type:Array }, peopleColorData:{ type:Array }, peopleColorData2:{ type:Array } }, /** * 组件的初始数据 */ data: { ecA: { lazyLoad: true }, ecB: { lazyLoad: true }, }, observers: { async peopleLeft(newValue) { if (newValue.length !== 0) { console.log('people2') await this.initA() } }, }, lifetimes: { attached() { // @ts-ignore this.ecComponentA = this.selectComponent('#mychart-dom-bar') // @ts-ignore this.initA() } }, methods: { // 点击按钮后初始化图表 initA () { // @ts-ignore this.ecComponentA.init((canvas: any, width: any, height: any) => { const chart = echarts.init(canvas, null, { width: width, height: height }) PeopleChart2(chart,this.data.peopleColorData,this.properties.peopleLeft,this.data.peopleColorData2,this.properties.peopleright) return chart }) }, } })