Perform POI search with search()
masterUse the search() method to perform a nearby POI (Point of Interest) search. This method returns results formatted specifically for the WeChat Mini Program map component's markers.
map.search({
location: '39.915,116.404', // Optional: defaults to current location
iconPath: '/path/to/icon.png', // Required: marker icon path
query: '美食', // Optional: search keyword
success: (res) => {
// res.wxMarkerData: Array of markers ready for WeChat map component
// res.originalData: Original Place API response
console.log(res.wxMarkerData);
},
fail: (err) => {
console.error(err.errMsg, err.statusCode);
}
});