// subpages/issue/pages/topicsNumDetail/components/noProject/noProject.js // @ts-ignore import * as echarts from '../../../../../../components/ec-canvas/echarts'; import {getNoProjectChart,getNoProjectChart2} from '../../../../utils/echarts' Component({ /** * 组件的属性列表 */ properties: { noProjectData:{ type:Array, value:[] }, unpassedProjectPercent:{ type:Number, }, unpassedProject:{ type:Number }, isShow:{ type:Boolean, }, hotClose:{ type:Array, value:[] }, hotNumber:{ type:Number, }, closedNumber:{ type:Number, }, hotPercent:{ type:Number, }, closedPercent:{ type:Number, }, issueTotal:{ type:Number, }, colorNoProject:{ type:Array } }, observers: { unpassedProjectPercent(newval) { this.setData({ isShow6:!this.data.isShow6 }) setTimeout(() => { this.setData({ isShow6:!this.data.isShow6 }) }, 1000) // this.getEcharts() } }, lifetimes: { attached: function() { // 在组件实例进入页面节点树时执行 }, detached: function() { // 在组件实例被从页面节点树移除时执行 if(this.data.chart){ // @ts-ignore this.data.chart.dispose() } }, }, /** * 组件的初始数据 */ data: { ec: { // onInit: this.getEcharts() // lazyLoad: true }, chart:null, isShow6:true, setInterval:null, ecComponent:'' }, /** * 组件的方法列表 */ methods: { echartInit (e) { this.data.chart = echarts.init(e.detail.canvas, null, { width: e.detail.width, height: e.detail.height }); e.detail.canvas.setChart(this.data.chart); // @ts-ignore this.data.chart.setOption(getNoProjectChart(this.properties.noProjectData)) }, echartInit2 (e) { getNoProjectChart2(e.detail.canvas, e.detail.width, e.detail.height,this.properties.hotClose,this.properties.colorNoProject); }, goIndex(){ wx.navigateTo({ url: '/subpages/issue/pages/list/issueList/issueList' }); }, // getEcharts(){ // this.ecComponent = this.selectComponent('#mychart-dom-pie') // this.ecComponent.init((canvas:any, width:any, height:any) => { // // 初始化图表 // const Chart = echarts.init(canvas, null, { // width: width, // height: height // }); // Chart.setOption(getNoProjectChart(this.properties.noProjectData)); // // 注意这里一定要返回 chart 实例,否则会影响事件处理等 // return Chart; // }); // }, } })