Browse Source

各处的展馆导航:显示并使用从接口拿到的展馆信息

任一存 3 năm trước cách đây
mục cha
commit
991338cb22

+ 2 - 2
code/src/views/exhibition/exhibition/guide.vue

@@ -42,11 +42,11 @@ onMounted(() => {
   map.value = new global.AMap.Map("map", {
     mapStyle: "amap://styles/fresh",
     zoom: 13,
-    center: [113.524914, 22.230397],
+    center: [props.currentMuseumItem.lng, props.currentMuseumItem.lat],
   });
 
   var marker = new AMap.Marker({
-    position: new AMap.LngLat(113.524914, 22.230397), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+    position: new AMap.LngLat(props.currentMuseumItem.lng, props.currentMuseumItem.lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
     title: "广东",
   });
 

+ 2 - 2
code/src/views/exhibition/exhibition/mobile/guide.vue

@@ -41,11 +41,11 @@ onMounted(() => {
   map.value = new global.AMap.Map("map", {
     mapStyle: "amap://styles/fresh",
     zoom: 13,
-    center: [113.524914, 22.230397],
+    center: [props.currentMuseumItem.lng, props.currentMuseumItem.lat],
   });
 
   var marker = new AMap.Marker({
-    position: new AMap.LngLat(113.524914, 22.230397), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+    position: new AMap.LngLat(props.currentMuseumItem.lng, props.currentMuseumItem.lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
     title: "广东",
   });
 

+ 10 - 10
code/src/views/gdmuseum/exhibition/guide.vue

@@ -29,24 +29,24 @@ import { defineProps, defineEmits, watch, onMounted, nextTick, ref } from "vue";
 
 const map = ref("");
 
-    const props = defineProps({
-      currentMuseumItem: {
-        type: Object,
-        default: () => {
-          return {}
-        },
-      },
-    });
+const props = defineProps({
+  currentMuseumItem: {
+    type: Object,
+    default: () => {
+      return {}
+    },
+  },
+});
 
 onMounted(() => {
   map.value = new global.AMap.Map("map", {
     mapStyle: "amap://styles/fresh",
     zoom: 13,
-    center: [113.524914, 22.230397],
+    center: [props.currentMuseumItem.lng, props.currentMuseumItem.lat],
   });
 
   var marker = new AMap.Marker({
-    position: new AMap.LngLat(113.524914, 22.230397), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+    position: new AMap.LngLat(props.currentMuseumItem.lng, props.currentMuseumItem.lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
     title: "广东",
   });
 

+ 2 - 2
code/src/views/gdmuseum/exhibition/mobile/guide.vue

@@ -41,11 +41,11 @@ onMounted(() => {
   map.value = new global.AMap.Map("map", {
     mapStyle: "amap://styles/fresh",
     zoom: 13,
-    center: [113.524914, 22.230397],
+    center: [props.currentMuseumItem.lng, props.currentMuseumItem.lat],
   });
 
   var marker = new AMap.Marker({
-    position: new AMap.LngLat(113.524914, 22.230397), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
+    position: new AMap.LngLat(props.currentMuseumItem.lng, props.currentMuseumItem.lat), // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
     title: "广东",
   });
 

+ 4 - 1
code/src/views/gdmuseum/index.vue

@@ -9,7 +9,10 @@
 
     <vtab @handleTab="handleTab" :list="menu" class="tabcon" />
 
-    <component :key="panelPage" class="limitwidth" :is="panelPage"></component>
+    <component
+      :key="panelPage" class="limitwidth" :is="panelPage"
+      :currentMuseumItem="currentMuseum"
+    ></component>
   </div>
 </template>