changeMap(menuItem) { // console.log(menuItem) let self = this; if (menuItem == '百度地图') { var ls = new BMap.LocalSearch(self.Info.City); ls.search(self.Info.Name); ls.setSearchCompleteCallback(function (searchResult) { console.log('eee', ls.getStatus(), BMAP_STATUS_SUCCESS, searchResult) if (ls.getStatus() == BMAP_STATUS_SUCCESS) { window.location.href = searchResult.moreResultsUrl; } else { return self.toast_warn("查无此地!"); } }); } else if (menuItem == '高德地图') { AMap.plugin(["AMap.PlaceSearch"], function () { //构造地点查询类 var placeSearch = new AMap.PlaceSearch({ pageSize: 1, // 单页显示结果条数 pageIndex: 1, // 页码 }); //关键字查询 placeSearch.search(self.Info.Name, function (status, result) { if (JSON.stringify(result) != "{}" && result.poiList.pois.length > 0) {// 查询成功时,result即对应匹配的POI信息 // window.location.href = "https://m.amap.com/search/mapview/keywords=" + self.Info.Name + "&city=" + result.poiList.pois[0].cityname + "&poiid=" + result.poiList.pois[0].id + "&src=pc"; window.location.href = "https://m.amap.com/search/mapview/poiid=" + result.poiList.pois[0].id; } else { return self.toast_warn("查无此地!"); } }) }); } },