map.chooseLocation
打开地图选择位置。
需引入
MapKit
,且在>=1.0.6
版本才可使用
Use in Ray
// @ray-js/ray >=1.1.0
import { map } from '@ray-js/ray';
const { chooseLocation } = map;
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
latitude | number | 否 | 目标地纬度 | |
longitude | number | 否 | 目标地经度 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
name | string | 位置名称 |
address | string | 详细地址 |
latitude | number | 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 |
longitude | number | 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
函数定义示例
/**
* 打开地图选择位置。
*/
export function chooseLocation(params?: {
/** 目标地纬度 */
latitude?: number;
/** 目标地经度 */
longitude?: number;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: {
/** 位置名称 */
name: string;
/** 详细地址 */
address: string;
/** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
latitude: number;
/** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
longitude: number;
}) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
map.updateGeofence
更新地理围栏。
权限: [scope.location]
需引入
MapKit
,且在>=3.0.1
版本才可使用
Use in Ray
// @ray-js/ray >=1.1.0
import { map } from '@ray-js/ray';
const { updateGeofence } = map;
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
registerGeoFence | array | 是 | 注册的地理围栏 | |
unregisterGeoFence | array | 是 | 取消的地理围栏 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
success | boolean | 更新成功 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
函数定义示例
/**
* 更新地理围栏
*权限: [scope.location]
*/
export function updateGeofence(params: {
/** 注册的地理围栏 */
registerGeoFence: GeofenceInfo[];
/** 取消的地理围栏 */
unregisterGeoFence: GeofenceInfo[];
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: {
/** 更新成功 */
success?: boolean;
}) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。