This commit is contained in:
lcw
2025-08-06 14:25:36 +08:00
parent 2b06febd8e
commit 71487ac647
15 changed files with 1067 additions and 383 deletions

View File

@ -46,11 +46,15 @@ const mMap = ref(null); //地图对象
const mapUtil = ref(null); //地图工具对象
const zoomTarget = ref(6);
// 定义组件发出的事件
const emit = defineEmits(['mapLoaded'])
const props = defineProps({
mapid: {
type: String,
default: "mapDiv"
},
//是否显示可以切换地图底图
isShow: {
type: Boolean,
@ -79,13 +83,15 @@ let map;
let mapLayer;
let mapLayer1;
onMounted(() => {
console.log("xxxxxxx");
emitter.on("followUp", (res) => {
let box = document.getElementsByClassName("changeMap_box");
if (!box) return;
box[0].style.right = !res ? "4px" : "398px";
box[0].style.transition = "0.5s";
});
map = new EliMap({
id: props.mapid,
crs: "EPSG:3857",
@ -110,6 +116,8 @@ onMounted(() => {
url: 'http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}',
})
zoomTarget.value = map.mapboxGLMap.getZoom();
// 地图加载完成后发出事件
emit('mapLoaded')
});
mapUtil.value = new MapUtil(map);
@ -253,7 +261,7 @@ const mapSetLayer = (id, source) => {
//获取地图绘制的数据
const resFun = (coord, type, flag, data) => {
emitter.emit("coordString", {
coord: coord,
type: type,