Skip to content

AMap.PlaceSearch搜索不到自定义的点标记 Marker #258

@yichenw7

Description

@yichenw7
  • 我已经搜索过 issue,没有类似的问题,或者类似的问题仍然没有解决方案。
    没有搜到相关

  • 我已经搜索过文档,并且仍然没有找到解决方案。
    没有搜到相关

  • 我写了个问题重现的例子,链接或者代码将会贴在下面。
    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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions