高德地图API:https://lbs.amap.com/api/javascript-api/reference/search#m_SearchResult
changeMap(menuKey, menuItem) { console.log(menuItem) var 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 { self.toast_warn('查无此地!') return } }) } 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) { console.log('dddd', 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; placeSearch.detailOnAMAP({ id: result.poiList.pois[0].id, name: self.Info.Name, location: result.poiList.pois[0].location }) } else { self.toast_warn('查无此地!') return } }) }) } },