<template> <div class="chart-container"> <div class="left"> <div class="modular"> <!--整个:左右50%--> <div class="modular-row-100"> <div class="modular-col-100"> <div class="modular-row-30"> <indicator/> </div> <div class="modular-row-30"> <div class="modular-col-60 modular-padding-right"> <commercial/> </div> <div class="modular-col-30"> <daily/> </div> </div> <div class="modular-row-30"> <div class="modular-col-60 modular-padding-right"> <assets/> </div> <div class="modular-col-30"> <structure/> </div> </div> </div><!-- .col50 over--> </div> </div> </div> </div> </template> <script> import Indicator from './components/indicator/indicator' import Assets from './components/assets/assets' import Expense from './components/expense/expense' import Building from './components/building/building' import Structure from './components/structure/structure' import Commercial from './components/commercial/commercial' import Daily from './components/daily/daily' export default { name: 'industrialEconomyLeft', components: { Daily, Structure, Commercial, Building, Assets, Expense, Indicator }, data () { return { populationComp: 0, // 人口组件 populationComps: ['youth-pie', 'special-bar', 'introduce4'], populationTimer: null, parkComp: 0, // 停车场组件 parkComps1: ['park-introduce', 'park-earth', 'park-income-count'], parkComps2: ['park-flow-line', 'park-detail', 'park-income-line'], parkTimer: null } }, mounted () { // this.populationChange() // setTimeout(() => { // this.parkChange() // }, 2000) }, methods: { // 人口组件切换 populationChange () { this.populationTimer = setTimeout(() => { const max = this.populationComps.length - 1 if (this.populationComp < max) { this.populationComp++ } else { this.populationComp = 0 } this.populationChange() }, 10000) }, // 停止切换人口组件 stopPopulationChange () { clearInterval(this.populationTimer) this.populationTimer = null }, parkChange () { this.parkTimer = setTimeout(() => { const max = this.parkComps1.length - 1 if (this.parkComp < max) { this.parkComp++ } else { this.parkComp = 0 } this.parkChange() }, 5000) }, stopParkChange () { clearInterval(this.parkTimer) this.parkTimer = null } }, beforeDestroy () { this.stopPopulationChange() this.stopParkChange() } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .chart-container{ position: absolute; top:0; left:.2rem; width: 30%; height:98%; display: flex; z-index: 20; justify-content: space-between; background: transparent; .left{ width:100%; height:100%; display: flex; justify-content: center; /*position: relative;*/ } .modular{ width:100%; height:100%; position:relative; .modular-50{ height:50%; wdith:100%; } } } .v-enter, .v-leave-to { opacity: 0; transform: translateX(-150px); } .v-enter-active, .v-leave-active { transition: all 0.5s ease; } </style>