diff --git a/src/components/AMap.vue b/src/components/AMap.vue index 9d17e5d..e88be60 100644 --- a/src/components/AMap.vue +++ b/src/components/AMap.vue @@ -20,6 +20,11 @@ const props = defineProps({ type: Array, default: () => [], }, + // 地图中心点 + mapCenter: { + type: Array, + default: () => [], + }, }); const mapContainer = ref(null); @@ -36,7 +41,7 @@ const clearMarkers = () => { }; // 添加点位 -const emit = defineEmits(['marker-click']) // 添加事件发射器 +const emit = defineEmits(["marker-click"]); // 添加事件发射器 const addMarkers = () => { clearMarkers(); @@ -69,7 +74,7 @@ const addMarkers = () => { margin-left: 4px; box-sizing: border-box; font-weight: bold; - ">${marker.total || ''}间 + ">${marker.total || ""}间 `; @@ -78,16 +83,16 @@ const addMarkers = () => { content: content, offset: new AMap.Pixel(-15, -15), }); - + // 添加点击事件 - amarker.on('click', () => { - emit('marker-click', { - marker, + amarker.on("click", () => { + emit("marker-click", { + marker, index, - position: [marker.longitude, marker.latitude] - }) + position: [marker.longitude, marker.latitude], + }); map.setCenter([marker.longitude, marker.latitude]); - map.setZoom(12); + map.setZoom(15); }); markers.push(amarker); map.add(amarker); @@ -123,6 +128,10 @@ onMounted(async () => { }, { deep: true } ); + watch(()=>props.mapCenter,(newVal,oldVal)=>{ + map.setCenter(newVal) + }, + {deep:true}) } catch (error) { console.error("地图加载失败:", error); } diff --git a/src/router/index.ts b/src/router/index.ts index 421cffa..c5df2e9 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -34,6 +34,11 @@ const routes: Array = [ component: () => import('@/view/showings/index.vue'), meta: { title: 'showings' }, }, + { + path: 'HouseDetail', + component: () => import('@/view/showings/houseDetail.vue'), + meta: { title: 'showings' }, + }, { path: 'contact', component: () => import('@/view/contact/index.vue'), diff --git a/src/style.css b/src/style.css index 69edbd7..9edc23c 100644 --- a/src/style.css +++ b/src/style.css @@ -29,3 +29,20 @@ .arco-theme-color-text-1 { background-color: #f2f7ff; } +/* 全局滚动条样式 */ +::-webkit-scrollbar { + width: 6px; + height: 6px; +} +::-webkit-scrollbar-track { + background: #f1f1f1; + border-radius: 3px; +} +::-webkit-scrollbar-thumb { + background: #c1c1c1; + border-radius: 3px; +} + +::-webkit-scrollbar-thumb:hover { + background: #a8a8a8; +} diff --git a/src/view/showings/components/Agency.vue b/src/view/showings/components/Agency.vue index ad961c2..2227102 100644 --- a/src/view/showings/components/Agency.vue +++ b/src/view/showings/components/Agency.vue @@ -7,7 +7,7 @@ \ No newline at end of file diff --git a/src/view/showings/components/HouseList.vue b/src/view/showings/components/HouseList.vue index a5a12e9..8f2e2da 100644 --- a/src/view/showings/components/HouseList.vue +++ b/src/view/showings/components/HouseList.vue @@ -3,7 +3,7 @@
选择房型
-
+
{{ item.name }}
@@ -27,6 +27,8 @@