LBS位置服务 ¶
获取定位 getLocation ¶
- 参数说明
参数 | 类型 | 是否必填 | 默认 | 说明 |
---|---|---|---|---|
ip | String | 否 | 需要搜索的IP地址(仅支持国内)若用户不填写IP,则取客户http之中的请求来进行定位 |
js
import { getDistrict } from
// 原型
uniLbs.getLocation(ip).then((res) => {})
// 例子
uniLbs.getLocation().then((res) => {
})
获取地区 getDistrict ¶
- 参数说明
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
keyword | string | 是 | 查询关键字 |
- 示例
js
import { getDistrict } from
// 原型
getDistrict(keyword).then((res) => {})
// 例子
getDistrict('福建省').then((res) => {
})
路径规划 getRoutes ¶
- 参数说明
参数 | 类型 | 是否必填 | 默认 | 说明 |
---|---|---|---|---|
param | Object | 否 | api接口参数 | |
traffic_type | String | 否 | driving | 交通工具类型 |
param参数详情
json
{
origin: '26.074054,119.318390',
destination: '26.074054,119.318390',
}
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
origin | String | 是 | 起点坐标 |
destination | String | 是 | 终点坐标 |
- 示例
js
// 原型
getRoutes(param, traffic_type).then((res) => {})
// 例子
let param = {
origin: '26.074054,119.318390',
destination: '26.074054,119.318390',
}
getRoutes(param, 'bicycling').then((res) => {
this.routes = res.result.routes;
})