From 0b1945c8f4bc836c7b42f724e3419e3b0076ec05 Mon Sep 17 00:00:00 2001 From: Kubbo <390378816@qq.com> Date: Sun, 3 Nov 2024 20:52:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=B8=B2=E6=9F=93=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AppMap.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/views/AppMap.vue b/src/views/AppMap.vue index b7dcb62..b682db0 100644 --- a/src/views/AppMap.vue +++ b/src/views/AppMap.vue @@ -63,13 +63,17 @@ export default { return this.geoJson = {type: 'FeatureCollection', features: maps.flat(1)} }) }, - initMap() { + async initMap() { const {echarts, turf} = window const boundary = turf.union(this.geoJson) boundary.properties.name = "boundary" this.geoJson.features.unshift(boundary) echarts.registerMap('zhengzhou', this.geoJson) this.map = echarts.init(this.$el) + while (!this.map) { + await new Promise(resolve => setTimeout(resolve, 500)) + this.map = echarts.init(this.$el) + } const areaColor = { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [ {offset: 0, color: 'rgba(61,127,255,0.35)'},