mc.chooseLocation(Object object)

打开地图选择位置。

Object object 参数

属性 类型 默认值 必填 说明
subKey String 地图使用的key,可前往各地图厂商开发者网站申请。
latitude Number 目标地纬度
longitude Number 目标地经度
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.success(Object res) 回调函数

属性 类型 说明
name String 位置名称
address String 详细地址
latitude Number 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系
longitude Number 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系

示例代码:

mc.chooseLocation({
  subKey: 'xxxx-xxxx-xxxx',
  latitude: this.locationInfo.lat,
  longitude: this.locationInfo.lng,
  complete: function (res) {
    console.log(res.name, res.address, res.latitude, res.longitude)
  },
})

results matching ""

    No results matching ""

    results matching ""

      No results matching ""