From 1b3f8b875ed16cad81abf8f69e5f347561c76085 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Thu, 11 Jan 2024 09:18:05 +0800 Subject: [PATCH] 地图优化 --- src/views/toCarryOutLegislativeReforms/components/locationMap.vue | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/views/toCarryOutLegislativeReforms/components/locationMap.vue b/src/views/toCarryOutLegislativeReforms/components/locationMap.vue index 55060e6..4977b9b 100644 --- a/src/views/toCarryOutLegislativeReforms/components/locationMap.vue +++ b/src/views/toCarryOutLegislativeReforms/components/locationMap.vue @@ -42,6 +42,14 @@ > ������ </el-button> + <el-button + v-if="$parent.mapType==='edit'" + type="primary" + :disabled="placeSearchName===''" + @click="close" + > + ������ + </el-button> </div> <div id="mapd" /> </div> @@ -60,7 +68,7 @@ map: null, geolocation: null, marker: null, - placeSearchName: null, + placeSearchName: '', mapPlaceSearch: null, position: [], positionInput: '' @@ -133,13 +141,17 @@ map: map, position: that.$parent.position }) - that.positionInput = that.$parent.position.join(',') + that.positionInput = that.toFixed(that.$parent.position[0], 8) + ',' + that.toFixed(that.$parent.position[1], 8) that.marker.setMap(map) that.map.setCenter(that.$parent.position) that.marker.setAnimation('AMAP_ANIMATION_BOUNCE') this.placeSearchName = this.$parent.address } }, + toFixed (str, decimalPlaces) { + const num = parseFloat(str) + return num.toFixed(decimalPlaces) + }, getAddress (position) { AMap.plugin('AMap.Geocoder', () => { const geocoder = new AMap.Geocoder({}) -- Gitblit v1.8.0