|
@@ -19,7 +19,7 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
|
|
|
- <div class="guidebtn">查看导览</div>
|
|
|
+ <div class="guidebtn" @click="onClickGuide">查看导览</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -29,24 +29,28 @@ 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 {}
|
|
|
+ },
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const onClickGuide = () => {
|
|
|
+ window.open(`https://uri.amap.com/marker?name=${props.currentMuseumItem.name}&position=${props.currentMuseumItem.lng},${props.currentMuseumItem.lat}&callnative=1`)
|
|
|
+}
|
|
|
|
|
|
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: "广东",
|
|
|
});
|
|
|
|