This commit is contained in:
parent
534baec75d
commit
ce846cc58f
|
|
@ -70,20 +70,23 @@ export default {
|
|||
watch: {
|
||||
positionPoint: {
|
||||
handler(newVal) {
|
||||
if (newVal && this.latitude && this.longitude && window.olMap) {
|
||||
const newLocation = fromLonLat(
|
||||
[this.longitude, this.latitude],
|
||||
"EPSG:3857"
|
||||
);
|
||||
this.$message.success("定位成功");
|
||||
this.updateMapPosition(this.longitude, this.latitude);
|
||||
window.olMap.getView().animate({
|
||||
center: newLocation,
|
||||
zoom: 13
|
||||
});
|
||||
if (newVal) {
|
||||
if (newVal && this.latitude && this.longitude && window.olMap) {
|
||||
const newLocation = fromLonLat(
|
||||
[this.longitude, this.latitude],
|
||||
"EPSG:3857"
|
||||
);
|
||||
this.$message.success("定位成功");
|
||||
this.updateMapPosition(this.longitude, this.latitude);
|
||||
window.olMap.getView().animate({
|
||||
center: newLocation,
|
||||
zoom: 13
|
||||
});
|
||||
}
|
||||
if (this.latitude === "" && this.longitude === "") {
|
||||
this.$message.error("定位失败,请稍后重试");
|
||||
}
|
||||
this.$store.commit("SET_POSITIONPOINT", false);
|
||||
} else {
|
||||
this.$message.error("定位失败,请稍后重试");
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue