From 032359484112eda5fe7ed465554c6828e03a4d3e Mon Sep 17 00:00:00 2001
From: JiangQiming <291854119@qq.com>
Date: Thu, 5 Jan 2023 17:42:20 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=B0=E5=9B=BE=E6=A0=87=E8=AE=B0?=
=?UTF-8?q?=E7=82=B9=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F=E6=9B=B4=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/GeoComponent/index.vue | 22 ++++++++--------------
src/components/ValueItem/index.vue | 2 +-
2 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/components/GeoComponent/index.vue b/src/components/GeoComponent/index.vue
index c22186a3..f8d44a1a 100644
--- a/src/components/GeoComponent/index.vue
+++ b/src/components/GeoComponent/index.vue
@@ -23,6 +23,7 @@
@click="clickMap"
>
+
{{ mapPoint }}
@@ -49,7 +50,7 @@ const props = defineProps({
});
const emit = defineEmits();
-// 手动输入的坐标点
+// 手动输入的坐标点(经纬度字符串)
const inputPoint = computed({
get: () => {
return props.point;
@@ -67,7 +68,7 @@ const handleModalSubmit = () => {
modalVis.value = false;
};
-// 地图拾取的坐标点
+// 地图拾取的坐标点(经纬度字符串)
const mapPoint = ref('');
const zoom = ref(12);
@@ -75,6 +76,9 @@ const center = ref([106.55, 29.56]);
let map: any = null;
let marker: any = null;
+// 地图经纬度
+const position = ref([]);
+
/**
* 地图初始化
* @param e
@@ -83,11 +87,7 @@ const initMap = (e: any) => {
map = e;
const pointStr = mapPoint.value as string;
- if (marker) map.remove(marker);
- marker = new AMap.Marker({
- position: pointStr ? pointStr.split(',') : center.value,
- });
- map.add(marker);
+ position.value = pointStr ? pointStr.split(',') : center.value;
};
/**
@@ -96,13 +96,7 @@ const initMap = (e: any) => {
*/
const clickMap = (e: any) => {
mapPoint.value = `${e.lnglat.lng},${e.lnglat.lat}`;
-
- if (marker) map.remove(marker);
-
- marker = new AMap.Marker({
- position: [e.lnglat.lng, e.lnglat.lat],
- });
- map.add(marker);
+ position.value = [e.lnglat.lng, e.lnglat.lat];
};
/**
diff --git a/src/components/ValueItem/index.vue b/src/components/ValueItem/index.vue
index f969355b..50b01a6f 100644
--- a/src/components/ValueItem/index.vue
+++ b/src/components/ValueItem/index.vue
@@ -107,7 +107,7 @@ const props = defineProps({
// 组件类型
itemType: {
type: String,
- default: () => 'object',
+ default: () => 'geoPoint',
},
// 下拉选择框下拉数据
options: {