Commit f66b9639 by wangzhihui

地图切换

1 parent be63bdeb
......@@ -173,9 +173,14 @@ export default {
});
AMap.invoke("autocompleteShow");
AMap.invoke("autocompleteAddEventListener", "onconfirm", (e) => {
this.poi = e.item.value;
this.$set(this.form, "address", this.poi.address);
this.$refs.addressInput.focus();
let _poi = e.item.value;
// this.$set(this.form, "address", this.poi.address);
let _params = {};
_params.lng = _poi.location.lng;
_params.lat = _poi.location.lat;
this.addPoiMarker(_params, "search");
// this.$refs.poiMapSearch.focus();
});
this.initMapEvent();
this.getPoiTrack();
......@@ -297,12 +302,10 @@ export default {
// marker点击事件
markerEvent(e) {
console.log(e)
let _params = e;
this.setPoiInfo(e);
let point = e.latLng;
AMap.invoke("getLocation", point, (res) => {
console.log(res)
let _pois = res.surroundingPois || [];
_params.address = res.address;
_params.near = _pois[0] ? _pois[0].title : "";
......@@ -333,26 +336,6 @@ export default {
this.hideFooter = !this.hideFooter;
},
// 绑定搜索
bindSearch() {
const _this = this;
AMap.plugin("AMap.AutoComplete", function () {
let autoComplete = new AMap.AutoComplete({
input: "poiMapSearch",
});
autoComplete.on("select", function (e) {
console.log(e);
let _poi = e.poi || {};
let _params = {};
_params.lng = _poi.location.lng;
_params.lat = _poi.location.lat;
_this.addPoiMarker(_params, "search");
});
});
},
// 返回列表页面
goListPage() {
let path = `/trialRun#/poi/index`;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!