data () { return { resizeTimer: null, myChart1: null, myChart2: null, myChart3: null, myChart4: null } }, methods: { // 综合得分 雷达图 getScoreChart () { let myChart = window.echarts.init(document.getElementById('compositeScore')) myChart.clear() this.myChart1 = myChart myChart.setOption(this.option) }, // 园区人员柱状图 getPersonChart () { let myChart = window.echarts.init(document.getElementById('personChart')) myChart.clear() this.myChart2 = myChart myChart.setOption(this.personOption) }, // 车辆信息 柱状折线图 getcarInfoChart () { let myChart = window.echarts.init(document.getElementById('carInfoChart')) myChart.clear() this.myChart3 = myChart myChart.setOption(this.carInfoOption) }, // 今日用能 折线柱状图 getTodayEnergyOption() { let myChart = window.echarts.init(document.getElementById('todayEnergy')) myChart.clear() this.myChart4 = myChart myChart.setOption(this.todayEnergyOption) } }, mounted () { this.$nextTick(function(){ let _t = this setTimeout(function(){ _t.initSwiper() },500) // swiper 初始化 (因为dom渲染完成才能初始化Swiper,所以必须将初始化放入vue的生命周期钩子函数mounted中:) // new Swiper('.swiper-container', { // pagination: '.swiper-pagination', // paginationClickable: true, // observer:true,//启动动态检查器(OB/观众/观看者),当改变swiper的样式(例如隐藏/显示)或者修改swiper的子元素时,自动初始化swiper。 // observeParents:true,//将observe应用于Swiper的父元素。当Swiper的父元素变化时,例如window.resize,Swiper更新 // direction: 'vertical', // autoplay: 2000 // }) }) // // 出租率 // // this.common.characteristicAlarm('pie3','#00C1B1','#30E2DF','30','70') // this.common.characteristicAlarm('pie4','#0D9DFE','#0D9DFE','30','70') // this.common.characteristicAlarm('pie5','#00C1B1','#30E2DF','30','70') // this.common.characteristicAlarm('pie6','#00C1B1','#30E2DF','30','70') // this.common.characteristicAlarm('pie7','#00C1B1','#30E2DF','30','70') // this.common.characteristicAlarm('pie8','#00C1B1','#30E2DF','30','70') // // // 企业总数环形 this.common.drawPie('park-pie1') // this.common.drawPie('park-pie3') let _this = this; window.addEventListener('resize', function () { if (_this.resizeTimer) clearTimeout(_this.resizeTimer); _this.resizeTimer = setTimeout(function () { _this.myChart1.resize(); _this.myChart2.resize(); _this.myChart3.resize(); _this.myChart4.resize(); }, 100) }) }
浙公网安备 33010602011771号