修改地图调用顺序

lijinlong
吕天方 1 year ago
parent 508d69b116
commit 36fb52e530

@ -4,7 +4,7 @@
* @Author: JC9527 * @Author: JC9527
* @Date: 2023-08-14 14:40:02 * @Date: 2023-08-14 14:40:02
* @LastEditors: JC9527 * @LastEditors: JC9527
* @LastEditTime: 2023-12-20 10:36:23 * @LastEditTime: 2023-12-20 14:58:40
--> -->
<template> <template>
<div class="pc-container"> <div class="pc-container">
@ -12,7 +12,7 @@
<div class="left-tags"> <div class="left-tags">
<div class="new-time">{{ now.date }}</div> <div class="new-time">{{ now.date }}</div>
<div class="new-time">{{ now.hour + ":" + now.minute + ":" + now.second }}</div> <div class="new-time">{{ now.hour + ":" + now.minute + ":" + now.second }}</div>
<div class="new-work" @click="getcodeImg">{{ currentWork }}</div> <div class="new-work">{{ currentWork }}</div>
</div> </div>
<div class="system-title" text="城市精细化管理监测主题"> <div class="system-title" text="城市精细化管理监测主题">
城市精细化管理监测主题 城市精细化管理监测主题

@ -503,16 +503,6 @@ export default {
// console.log(o.getCenter()) // console.log(o.getCenter())
// console.log(this.map,'initMapinitMap'); // console.log(this.map,'initMapinitMap');
this.$nextTick(() => { this.$nextTick(() => {
//
this.getWanggeGeoJson();
//
this.getWeilanGeoJson();
//
this.getQuyuGeoJson();
//
this.getLuduanGeoJson();
//
this.getMarkers(1);
AMap.plugin('AMap.GeoJSON',()=>{ AMap.plugin('AMap.GeoJSON',()=>{
let polygon let polygon
var geojson = new AMap.GeoJSON({ var geojson = new AMap.GeoJSON({
@ -530,6 +520,16 @@ export default {
map.add(geojson) map.add(geojson)
map.setFitView(polygon); map.setFitView(polygon);
}) })
//
this.getWanggeGeoJson();
//
this.getWeilanGeoJson();
//
this.getQuyuGeoJson();
//
this.getLuduanGeoJson();
//
this.getMarkers(1);
}); });
// console.log(this.$refs.map.$$getInstance(),'TTTTTTT') // console.log(this.$refs.map.$$getInstance(),'TTTTTTT')
}, },
@ -1015,8 +1015,8 @@ export default {
'white-space': 'nowrap', 'white-space': 'nowrap',
}, },
}); });
this.map.add(wangge); this.map.add([wangge,text]);
this.map.add(text); // this.map.add(text);
}) })
}) })
}, },
@ -1052,8 +1052,8 @@ export default {
'white-space': 'nowrap', 'white-space': 'nowrap',
}, },
}); });
this.map.add(circle); this.map.add([circle,text]);
this.map.add(text); // this.map.add(text);
// //
} else if (shapeStr.features[0].geometry.type == "Polygon") { } else if (shapeStr.features[0].geometry.type == "Polygon") {
var wangge = new AMap.Polygon({ var wangge = new AMap.Polygon({
@ -1081,8 +1081,8 @@ export default {
'white-space': 'nowrap', 'white-space': 'nowrap',
}, },
}); });
this.map.add(wangge); this.map.add([wangge,text]);
this.map.add(text); // this.map.add(text);
} }
}) })
}) })
@ -1114,8 +1114,8 @@ export default {
'white-space': 'nowrap', 'white-space': 'nowrap',
}, },
}); });
this.map.add(quyu); this.map.add([quyu,text]);
this.map.add(text); // this.map.add(text);
}) })
}) })
}, },
@ -1146,8 +1146,8 @@ export default {
'white-space': 'nowrap', 'white-space': 'nowrap',
}, },
}); });
this.map.add(luduan); this.map.add([luduan,text]);
this.map.add(text); // this.map.add(text);
}) })
}) })
}, },

Loading…
Cancel
Save