| | |
| | | <template> |
| | | <div class="echarts-wrapper"> |
| | | <div class="echarts-wrapper" @dblclick="dblclick"> |
| | | <div class="echarts-content" ref="chart" id="cityChart"> |
| | | |
| | | </div> |
| | |
| | | chartData: "", |
| | | data() { |
| | | return { |
| | | parentsStyle: {}, |
| | | isAllScreen: false, |
| | | timers: null, |
| | | mapName: 'zhongguo', |
| | | mapInfoX: null, |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | findParents(node, select) { |
| | | var parent = node.parentNode; |
| | | if (parent === null || parent.className.indexOf(select) != -1) { |
| | | return parent; |
| | | } else { |
| | | return this.findParents(parent, select); |
| | | } |
| | | }, |
| | | dblclick(e) { |
| | | this.isAllScreen = !this.isAllScreen |
| | | let parents = this.findParents(e.currentTarget, 'vdr') |
| | | if (this.isAllScreen) { |
| | | this.parentsStyle = JSON.parse(JSON.stringify(parents.style)); |
| | | parents.style.transform = 'none'; |
| | | parents.style.width = '100%'; |
| | | parents.style.height = '100%'; |
| | | parents.style.position = 'fixed'; |
| | | parents.style.left = 0; |
| | | parents.style.right = 0; |
| | | parents.style.bottom = 0; |
| | | parents.style.top = 0; |
| | | parents.style.zIndex = 99999; |
| | | } else { |
| | | parents.style.transform = this.parentsStyle.transform; |
| | | parents.style.width = this.parentsStyle.width; |
| | | parents.style.height = this.parentsStyle.height; |
| | | parents.style.position = this.parentsStyle.position; |
| | | parents.style.left = 'initial'; |
| | | parents.style.right = 'initial'; |
| | | parents.style.bottom = 'initial'; |
| | | parents.style.top = 'initial'; |
| | | parents.style.zIndex = 'auto'; |
| | | } |
| | | this.$options.chart.resize(); |
| | | }, |
| | | setOption(opt) { |
| | | this.$options.chart.setOption(opt); |
| | | }, |
| | |
| | | ); |
| | | }, |
| | | outClear() { |
| | | console.log(this.timers) |
| | | window.removeEventListener('resize', this.resize); |
| | | clearInterval(this.timers) |
| | | this.timers = null |