AMap.PlaceSearch搜索不到自定义的点标记 Marker
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
+ [x] 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
没有搜到相关
+ [x] 我已经搜索过[文档](https://elemefe.github.io/react-amap/articles/start),并且仍然没有找到解决方案。
没有搜到相关
+ [x] 我写了个问题重现的例子,链接或者代码将会贴在下面。
window.AMap.plugin('AMap.PlaceSearch', () => {
placeSearch = new window.AMap.PlaceSearch({
input: 'tipinput',
pageSize: 10,
pageIndex: 1,
citylimit: false
// citylimit: true // 仅搜索本城市的地名
});
function select(e) {
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name); // 关键字查询查询
}
placeSearch.on('select', select); // 注册监听,当选中某条记录时会触发
});
const randomMarker = (len) =>
Array(len)
.fill(true)
.map((e, idx) => ({
position: {
longitude: 100 + Math.random() * 30,
latitude: 30 + Math.random() * 20
},
myLabel: `债券${alphabet[idx]}`,
myIndex: idx + 1,
title: `债券${alphabet[idx]}`,
address: `债券${alphabet[idx]}`,
name: `债券${alphabet[idx]}`,
district: `债券${alphabet[idx]}`
}));
this.markers = randomMarker(10);
#### Reproduce Example Link or Code Fragment
#### What is Expected?
#### What is actually happening?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.