bug
This commit is contained in:
		| @@ -14,7 +14,7 @@ | |||||||
|         </div> |         </div> | ||||||
|         <div class="address-search"> |         <div class="address-search"> | ||||||
|           <div class="address-search__wrapper"> |           <div class="address-search__wrapper"> | ||||||
|             <!-- <image src="./images/search.png" /> --> |             <image :src="$cdn + 'xincheng/search.png'" /> | ||||||
|             <input placeholder-style="color: #98A6B6" placeholder="搜索地点" v-model="address" @input="onChange"> |             <input placeholder-style="color: #98A6B6" placeholder="搜索地点" v-model="address" @input="onChange"> | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
| @@ -32,7 +32,8 @@ | |||||||
|         polygons: [], |         polygons: [], | ||||||
|         labels: [], |         labels: [], | ||||||
|         businessName: '', |         businessName: '', | ||||||
|         ops: {}, |         ops: { | ||||||
|  |         }, | ||||||
|         markers: [], |         markers: [], | ||||||
|         isShow: false, |         isShow: false, | ||||||
|         MarkerCluster: null, |         MarkerCluster: null, | ||||||
| @@ -154,7 +155,7 @@ | |||||||
|             } |             } | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           this.config.latlng && map.setCenter(this.config.latlng) |           // this.config.latlng && map.setCenter(this.config.latlng) | ||||||
|  |  | ||||||
|           this.MarkerCluster = new TMap.MarkerCluster({ |           this.MarkerCluster = new TMap.MarkerCluster({ | ||||||
|             map, gridSize: 60, |             map, gridSize: 60, | ||||||
| @@ -167,6 +168,10 @@ | |||||||
|             })) || [], |             })) || [], | ||||||
|             zoomOnClick: true |             zoomOnClick: true | ||||||
|           }) |           }) | ||||||
|  |           this.setCenter(points.map(e => { | ||||||
|  |             return new TMap.LatLng(e.lat, e.lng) | ||||||
|  |           })) | ||||||
|  |  | ||||||
|           let cls = [] |           let cls = [] | ||||||
|           this.MarkerCluster.on('cluster_changed', () => { |           this.MarkerCluster.on('cluster_changed', () => { | ||||||
|             if (this.markers.length) { |             if (this.markers.length) { | ||||||
| @@ -226,6 +231,19 @@ | |||||||
|             } |             } | ||||||
|           } |           } | ||||||
|         }) |         }) | ||||||
|  |       }, | ||||||
|  |  | ||||||
|  |       setCenter (arr) { | ||||||
|  |         var bounds = new TMap.LatLngBounds() | ||||||
|  |         arr.forEach(function(item){ | ||||||
|  |           if (bounds.isEmpty() || !bounds.contains(item)){ | ||||||
|  |             bounds.extend(item) | ||||||
|  |           } | ||||||
|  |         }) | ||||||
|  |  | ||||||
|  |         this.map.fitBounds(bounds, { | ||||||
|  |           padding: 100 | ||||||
|  |         }) | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user