修改地图组件

This commit is contained in:
A1300399510
2023-07-25 14:14:50 +08:00
parent 0fd2a83043
commit d999e79f10
2 changed files with 29 additions and 30 deletions

View File

@@ -3,14 +3,13 @@
<div class="" :class="{ 'pop': show }">
<div class="close flexcenter" @click="showPop">
<!-- <img class="icon" src="@/assets/img/publicImage/circle-close.png"> -->
<img class="icon" src="@/assets/img/publicImage/white-cross.svg">
</div>
<div id="container">
<div class="location-bj flexcenter" @click="showPop" v-if="!show">
<div class="location-site flexacenter">
<img class="tracingPoint" src="@/assets/img/publicImage/u1704.png" />
<div class="location-name">{{ props.info['address'] }}</div>
<div class="location-name">{{ props['name'] }}</div>
<img class="location-arrows" src="@/assets/img/publicImage/u353.svg" />
</div>
</div>
@@ -23,19 +22,14 @@
import { ref, defineProps } from 'vue';
const props = defineProps({
info: Object,
latlng: Object,
name: String,
})
// coordinate
let coordinate = props.info['coordinate']
console.log("coordinate", coordinate);
let key = ref("MVNBZ-PEFWI-O4OGT-5ADVJ-7QAYJ-NBFY4")
const initMap = () => {
let center = new TMap.LatLng(coordinate[0], coordinate[1]);
let center = new TMap.LatLng(props.latlng['longitude'], props.latlng['latitude']);
let map = new TMap.Map("container", {
zoom: 15,
disableDefaultUI: true, //禁止所有控件
@@ -46,12 +40,11 @@ const initMap = () => {
map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ZOOM);
map.removeControl(TMap.constants.DEFAULT_CONTROL_ID.ROTATION);
let marker = new TMap.MultiMarker({
id: "marker-layer",
map: map,
geometries: [{
"position": new TMap.LatLng(coordinate[0], coordinate[1]),
"position": new TMap.LatLng(props.latlng['longitude'], props.latlng['latitude']),
}]
});
}
@@ -68,10 +61,7 @@ loadScript(`https://map.qq.com/api/gljs?v=1.exp&key=${key.value}&callback=initMa
let show = ref(false) // 弹窗状态
const showPop = () => {
show.value = !show.value
console.log("showPop", showPop);
}
const showPop = () => show.value = !show.value
</script>