提供3D旋转和覆盖物标签隐藏/显示切换
This commit is contained in:
@@ -59,7 +59,8 @@ export default {
|
||||
// mods,
|
||||
chartList,
|
||||
map: null,
|
||||
lib: null
|
||||
lib: null,
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -122,13 +123,14 @@ export default {
|
||||
},
|
||||
renderMap(count = 0) {
|
||||
let {lib: AMap, map} = this
|
||||
this.timer && clearInterval(this.timer)
|
||||
if (AMap) {
|
||||
let infoWin = new AMap.InfoWindow({content: ""})
|
||||
map.clearMap()
|
||||
let markers = this.values.filter(e => e.lng).map(e => {
|
||||
return new AMap.Marker({
|
||||
map,
|
||||
content: e.content || `<div class="marker">
|
||||
content: e.content || `<div class="marker ${this.data.alwaysShow ? 'showLabel' : ''}">
|
||||
<img src="${e.icon}"/>
|
||||
<span>${e.label}</span>
|
||||
</div>`,
|
||||
@@ -147,7 +149,10 @@ export default {
|
||||
})
|
||||
})
|
||||
map.setFitView(markers)
|
||||
this.data.is3d && map.setPitch(60)
|
||||
this.data.is3d && map.setPitch(65)
|
||||
if (this.data.is3dAround == 1) {
|
||||
this.timer = setInterval(() => map?.setRotation(360, false, 16000))
|
||||
}
|
||||
} else if (count < 10) {
|
||||
console.log("正在加载...%s", count)
|
||||
setTimeout(() => this.renderMap(++count), 1000)
|
||||
@@ -220,7 +225,7 @@ export default {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover > span {
|
||||
&:hover > span, &.showLabel > span {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
|
||||
Reference in New Issue
Block a user