解决渲染失败的问题

This commit is contained in:
2024-11-03 20:52:03 +08:00
parent f1620c710f
commit 0b1945c8f4

View File

@@ -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)'},