| | |
| | | </div> |
| | | </div> |
| | | <div v-if="!mapLocation.isDetail" style="position: absolute;right:51%;top:7%;z-index: 999999;"> |
| | | <el-button type="info" icon="el-icon-location-outline" circle @click="createPoint"></el-button> |
| | | <el-button type="info" icon="el-icon-location-outline" circle @click="setCenterByDistrict()"></el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | if (this.mapLocation.location[0]&&this.mapLocation.location[1]){ |
| | | this.setCenter(this.mapLocation.location[0],this.mapLocation.location[1]) |
| | | } |
| | | }else { |
| | | this.createPoint() |
| | | } |
| | | |
| | | }, |
| | |
| | | getLocation(regionCode,regionName){ |
| | | this.region = regionCode |
| | | this.regionName = regionName |
| | | this.setCenterByDistrict(regionName) |
| | | }, |
| | | //搜索框选择 |
| | | handleSelect(item) { |
| | |
| | | view.setZoom(20); |
| | | }, |
| | | //根据区域名设置中心点 |
| | | setCenterByDistrict(regionName){ |
| | | setCenterByDistrict(){ |
| | | const that = this |
| | | let regionName = this.regionName |
| | | if (regionName.length ==0){ |
| | | this.$message.warning("请先选择行政区"); |
| | | return |
| | | } |
| | | AMap.plugin('AMap.DistrictSearch', function () { |
| | | // 创建行政区查询对象 |
| | | var district = new AMap.DistrictSearch({ |