Class: Suggestion

Suggestion

集成在线百度地图、高德地图的输入提示服务,坐标已适配;

new Suggestion(this.$map).search("河海").then(data => {
    console.log(data);
  });

Suggestion.getDataByAMap("河海", {
  city: "南京市",
  outputCoordType: "BMap"
}).then(data => {
  console.log(data);
});

new Suggestion(Viewer)

app/suggestion/Suggestion.js, line 26

构造一个suggestion对象

Name Type Description
Viewer Viewer

Classes

Suggestion

Methods

staticSuggestion.getDataByAMap(keywords, options, outputCoordType){Promise}

app/suggestion/Suggestion.js, line 63

调用高德的输入提示服务获取数据

Name Type Description
keywords String

输入的关键词

options Object

查询参数,可以不设置

Name Type Default Description
city String "全国" optional

查询城市

location Array

指定点位,传入location参数后,返回结果将以距离进行排序

outputCoordType String

输出的数据的坐标类型,AMap/BMap/TMap/GMap

options.url String

高德地图输入提示服务URL,有默认值

options.key String

高德地图输入提示服务key,有默认值

Returns:
Type Description
Promise 输入提示返回的数据

staticSuggestion.getDataByBMap(keywords, options, outputCoordType){Promise}

app/suggestion/Suggestion.js, line 79
Name Type Description
keywords String

输入的关键词

options Object

查询参数,可以不设置

Name Type Default Description
city String "全国" optional

查询城市

location Array

指定点位,传入location参数后,返回结果将以距离进行排序

outputCoordType String

输出的数据的坐标类型,AMap/BMap/TMap/GMap

options.url String

百度地图输入提示服务URL,有默认值

options.key String

百度地图输入提示服务key,有默认值

Deprecated
  • (弃用)调用百度的输入提示服务获取数据
    Returns:
    Type Description
    Promise 输入提示返回的数据
    app/suggestion/Suggestion.js, line 46

    获取输入提示

    Name Type Description
    keywords String

    输入的关键词

    options Object

    查询参数,可以不设置

    Name Type Default Description
    city String "全国" optional

    查询城市

    location Array

    指定点位,传入location参数后,返回结果将以距离进行排序

    Returns:
    Type Description
    Promise 输入提示返回的数据