|
@@ -19,7 +19,7 @@
|
|
</li>
|
|
</li>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
- <div class="guidebtn">查看导览</div>
|
|
|
|
|
|
+ <div class="guidebtn" @click="onClickGuide">查看导览</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -28,6 +28,7 @@
|
|
import { defineProps, defineEmits, watch, onMounted, nextTick, ref } from "vue";
|
|
import { defineProps, defineEmits, watch, onMounted, nextTick, ref } from "vue";
|
|
|
|
|
|
const map = ref("");
|
|
const map = ref("");
|
|
|
|
+
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
currentMuseumItem: {
|
|
currentMuseumItem: {
|
|
type: Object,
|
|
type: Object,
|
|
@@ -37,15 +38,19 @@ const props = defineProps({
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+const onClickGuide = () => {
|
|
|
|
+ window.open(`https://uri.amap.com/marker?name=${props.currentMuseumItem.name}&position=${props.currentMuseumItem.lng},${props.currentMuseumItem.lat}&callnative=1`)
|
|
|
|
+}
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
map.value = new global.AMap.Map("map", {
|
|
map.value = new global.AMap.Map("map", {
|
|
mapStyle: "amap://styles/fresh",
|
|
mapStyle: "amap://styles/fresh",
|
|
zoom: 13,
|
|
zoom: 13,
|
|
- center: [113.524914, 22.230397],
|
|
|
|
|
|
+ center: [props.currentMuseumItem.lng, props.currentMuseumItem.lat],
|
|
});
|
|
});
|
|
|
|
|
|
var marker = new AMap.Marker({
|
|
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: "广东",
|
|
title: "广东",
|
|
});
|
|
});
|
|
|
|
|