fix:修复车船gps运动错误的问题
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user