map.registerGeofence
注册地理围栏。
权限: [scope.location]
需引入
MapKit
,且在>=3.0.1
版本才可使用
Use in Ray
// @ray-js/ray >=1.1.0
import { map } from '@ray-js/ray';
const { registerGeofence } = map;
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
geoTitle | string | 否 | 地理围栏名称 | |
longitude | number | 否 | 经度 | |
latitude | number | 否 | 纬度 | |
radius | number | 否 | 半径 | |
geofenceId | string | 否 | id | |
type | number | 否 | 半径 0:进度地理围栏 1:离开地理围栏 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
函数定义示例
/**
* 注册地理围栏
*权限: [scope.location]
*/
export function registerGeofence(params?: {
/** 地理围栏名称 */
geoTitle?: string;
/** 经度 */
longitude?: number;
/** 纬度 */
latitude?: number;
/** 半径 */
radius?: number;
/** id */
geofenceId?: string;
/**
* 半径
* 0:进度地理围栏
* 1:离开地理围栏
*/
type?: number;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: null) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
map.unregisterGeofence
取消地理围栏 权限: [scope.location]
需引入
MapKit
,且在>=3.0.1
版本才可使用
Use in Ray
// @ray-js/ray >=1.1.0
import { map } from '@ray-js/ray';
const { unregisterGeofence } = map;
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
geoTitle | string | 否 | 地理围栏名称 | |
longitude | number | 否 | 经度 | |
latitude | number | 否 | 纬度 | |
radius | number | 否 | 半径 | |
geofenceId | string | 否 | id | |
type | number | 否 | 半径 0:进度地理围栏 1:离开地理围栏 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
函数定义示例
/**
* 取消地理围栏
*权限: [scope.location]
*/
export function unregisterGeofence(params?: {
/** 地理围栏名称 */
geoTitle?: string
/** 经度 */
longitude?: number
/** 纬度 */
latitude?: number
/** 半径 */
radius?: number
/** id */
geofenceId?: string
/**
* 半径
* 0:进度地理围栏
* 1:离开地理围栏
*/
type?: number
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void
/** 接口调用成功的回调函数 */
success?: (params: null) => void
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string
errorCode: string | number
innerError: {
errorCode: string | number
errorMsg: string
}
}) => void
}): void
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。