fix:修复车船gps运动错误的问题

This commit is contained in:
zjc
2025-01-26 16:56:04 +08:00
parent 72d26075e9
commit 396723e4c5
2 changed files with 36 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ import { ref } from 'vue'
export function useMap() {
let map = ref(null)
let marker = ref(null)
// 初始化地图
const initMap = (id, lat, lng, scale = 15, satellite) => {
map.value = new BMapGL.Map(id)
@@ -24,13 +25,13 @@ export function useMap() {
})
var point = new BMapGL.Point(...position)
// 创建标注对象并添加到地图
var marker = new BMapGL.Marker(point, { icon: iconPath })
map.value.addOverlay(marker)
marker.value = new BMapGL.Marker(point, { icon: iconPath })
map.value.addOverlay(marker.value)
}
// 清除覆盖物
const clearOverlays = () => {
map.value.clearOverlays()
}
return { map, initMap, addMarker, clearOverlays }
return { map, marker, initMap, addMarker, clearOverlays }
}