大屏设计增加地图图层设置

This commit is contained in:
aixianling
2023-04-24 16:24:34 +08:00
parent 4f9c4c8d27
commit c3fa9b8d79
4 changed files with 55 additions and 40 deletions

View File

@@ -22,7 +22,8 @@ export default {
mask: Boolean,
searchBus: {default: "2"},
pulseLines: Boolean,
onlyShowArea: Boolean
onlyShowArea: Boolean,
satellite: Boolean
},
computed: {
viewMode() {
@@ -33,7 +34,7 @@ export default {
return {
amap: null,
mapLib: null,
loca: null
loca: null,
}
},
watch: {
@@ -44,7 +45,7 @@ export default {
}
},
methods: {
initMap() {
initMap(c = 0) {
let {plugins, viewMode, mapStyle} = this
AMapLoader.load({
key: '54a02a43d9828a8f9cd4f26fe281e74e',
@@ -67,12 +68,16 @@ export default {
this.amap.on('complete', () => {
this.amap.setFitView();//视口自适应
})
/*增加卫星图层*/
if (this.satellite) {
this.amap.add([new AMap.TileLayer.RoadNet({zIndex: 11}), new AMap.TileLayer.Satellite({zIndex: 10})])
}
/* end */
this.$emit('update:map', this.amap)
this.$emit("loaded")
this.mapLoaded()
}
}).catch(this.initMap)
}).catch(() => c < 10 ? this.initMap(++c) : new Error("地图加载有问题"))
},
getMapArea() {
const {mapLib: AMap} = this