高德地圖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 } }) }) } },