Commit f66b9639 by wangzhihui

地图切换

1 parent be63bdeb
...@@ -173,9 +173,14 @@ export default { ...@@ -173,9 +173,14 @@ export default {
}); });
AMap.invoke("autocompleteShow"); AMap.invoke("autocompleteShow");
AMap.invoke("autocompleteAddEventListener", "onconfirm", (e) => { AMap.invoke("autocompleteAddEventListener", "onconfirm", (e) => {
this.poi = e.item.value; let _poi = e.item.value;
this.$set(this.form, "address", this.poi.address); // this.$set(this.form, "address", this.poi.address);
this.$refs.addressInput.focus(); let _params = {};
_params.lng = _poi.location.lng;
_params.lat = _poi.location.lat;
this.addPoiMarker(_params, "search");
// this.$refs.poiMapSearch.focus();
}); });
this.initMapEvent(); this.initMapEvent();
this.getPoiTrack(); this.getPoiTrack();
...@@ -297,12 +302,10 @@ export default { ...@@ -297,12 +302,10 @@ export default {
// marker点击事件 // marker点击事件
markerEvent(e) { markerEvent(e) {
console.log(e)
let _params = e; let _params = e;
this.setPoiInfo(e); this.setPoiInfo(e);
let point = e.latLng; let point = e.latLng;
AMap.invoke("getLocation", point, (res) => { AMap.invoke("getLocation", point, (res) => {
console.log(res)
let _pois = res.surroundingPois || []; let _pois = res.surroundingPois || [];
_params.address = res.address; _params.address = res.address;
_params.near = _pois[0] ? _pois[0].title : ""; _params.near = _pois[0] ? _pois[0].title : "";
...@@ -333,26 +336,6 @@ export default { ...@@ -333,26 +336,6 @@ export default {
this.hideFooter = !this.hideFooter; 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() { goListPage() {
let path = `/trialRun#/poi/index`; 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!