diff --git a/src/App.vue b/src/App.vue index 7e2c9c2..b1417fa 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,12 +2,45 @@ import HeaderNav from "@/components/HeaderNav.vue"; import Footer from "@/components/Footer.vue" +import {nextTick, ref, watch} from 'vue'; +import { useRoute, useRouter, RouterView } from 'vue-router'; +const route = useRoute(); +const router = useRouter(); +const routerUpdateKey = ref(Date.now()); +watch( + () => route.fullPath, + () => { + routerUpdateKey.value = Date.now(); // 改变 key 触发重新渲染 + // 额外:触发一次 DOM 刷新,确保菜单交互恢复 + nextTick(() => { + restoreMenuInteraction(); + }); + }, + { immediate: true, deep: true } +); +const restoreMenuInteraction = () => { + const menuItems = document.querySelectorAll('.menu-item'); // 替换为你的菜单类名 + menuItems.forEach(item => { + // 移除可能的禁用状态,恢复点击事件 + item.style.pointerEvents = 'auto'; + item.removeAttribute('disabled'); + // 重新绑定点击事件(如果事件丢失) + item.onclick = null; // 先清空旧事件 + item.addEventListener('click', (e) => { + // 这里可以复用你原有菜单点击逻辑,或触发路由跳转 + const path = item.dataset.path; // 假设菜单元素有 data-path 属性存路由 + if (path) { + router.push({ path }); + } + }); + }); +}; diff --git a/src/assets/main.css b/src/assets/main.css index b6bfe14..ed1b5e0 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -15,3 +15,4 @@ button{ .hover-effect{ cursor: pointer; } + diff --git a/src/components/HeaderNav.vue b/src/components/HeaderNav.vue index fe03732..2c3077e 100644 --- a/src/components/HeaderNav.vue +++ b/src/components/HeaderNav.vue @@ -1,8 +1,9 @@ diff --git a/src/components/Mask.vue b/src/components/Mask.vue new file mode 100644 index 0000000..6efbd31 --- /dev/null +++ b/src/components/Mask.vue @@ -0,0 +1,88 @@ + + + + + + + + diff --git a/src/components/about/AboutContactUs.vue b/src/components/about/AboutContactUs.vue index c4131f6..0cb33c9 100644 --- a/src/components/about/AboutContactUs.vue +++ b/src/components/about/AboutContactUs.vue @@ -6,8 +6,9 @@ import Map from "@/components/about/Map.vue"; // 百度地图组件引用 const bmapRef = ref(null); // 地图中心点坐标(飞利信大厦) -const mapCenter = ref({ lng: 116.372326, lat: 39.991868}); -//116.365873,39.985891 +const mapCenter = ref({ lng: 116.371127, lat: 39.992468}); +const mapMark = ref({ lng: 116.372326, lat: 39.991868}); +//高德坐标 116.365873,39.985891 // 组件挂载后操作地图 onMounted(() => { // 确保地图组件已经初始化完成 @@ -17,16 +18,16 @@ onMounted(() => { const mapInstance = bmapRef.value.getMap(); // 添加标记点 - const point = new window.BMap.Point(mapCenter.value.lng, mapCenter.value.lat); + const point = new window.BMap.Point(mapMark.value.lng, mapMark.value.lat); const marker = bmapRef.value.addMarker(point); - // 添加信息窗口 - bmapRef.value.openInfoWindow("飞利信大厦
地址:北京市海淀区塔院志新村2号", point); - - // 绑定点击事件 - marker.addEventListener("click", () => { - bmapRef.value.openInfoWindow("飞利信大厦
地址:北京市海淀区塔院志新村2号", point); - }); + // // 添加信息窗口 + // bmapRef.value.openInfoWindow("飞利信大厦
地址:北京市海淀区塔院志新村2号", point); + // + // // 绑定点击事件 + // marker.addEventListener("click", () => { + // bmapRef.value.openInfoWindow("飞利信大厦
地址:北京市海淀区塔院志新村2号", point); + // }); } }, 100); }); diff --git a/src/components/about/AboutDynamic.vue b/src/components/about/AboutDynamic.vue index d385903..9251641 100644 --- a/src/components/about/AboutDynamic.vue +++ b/src/components/about/AboutDynamic.vue @@ -1,5 +1,5 @@