条件 API
createCondition
创建条件
引入
import { createCondition } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.5.4
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
type | string | 是 | 条件类型 | |
condition | string | 否 | 条件内容 | |
index | number | 否 | 索引 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
type | string | 条件类型 |
condition | string | 条件内容 |
index | number | 索引 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
editCondition
编辑条件
引入
import { editCondition } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.5.4
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
type | string | 是 | 条件类型 | |
condition | string | 否 | 条件内容 | |
index | number | 否 | 索引 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
type | string | 条件类型 |
condition | string | 条件内容 |
index | number | 索引 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
场景功能页 API
openGuideScene
跳转场景引导页面
引入
import { openGuideScene } from '@ray-js/ray';
@ray-js/ray 需在
>=1.4.32
版本才可使用。IDE模拟器与真机调试环境当前无法使用。
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
action | string | 否 | 操作, add edit (Android端在App 5.10.0及以上版本支持) | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
请求示例
openGuideScene().then(() => {
console.log('调用成功打开场景引导页面');
});
openCreateScene
跳转创建场景页面 注意:当前Android端仅支持 Zigbee 本地场景。
引入
import { openCreateScene } from '@ray-js/ray';
@ray-js/ray 需在
>=1.4.32
版本才可使用。IDE模拟器与真机调试环境当前无法使用。
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | | -------- | ---------- | ------ | ---- | ------------------------------------------------ | --- | | devId | string
| | 否 | 设备 id (Android端在App 5.10.0及以上版本支持) | | | complete | function
| | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | | success | function
| | 否 | 接口调用成功的回调函数 | | fail | function
| | 否 | 接口调用失败的回调函数 |
请求示例
openCreateSence({
devId: "devId"
}).then(() => {
console.log('调用成功打开创建场景页面');
});
openEditScene
跳转编辑场景页面
引入
import { openEditScene } from '@ray-js/ray';
@ray-js/ray 需在
>=1.4.32
版本才可使用。IDE模拟器与真机调试环境当前无法使用。
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
devId | string | 否 | 设备 id (Android端在App 5.10.0及以上版本支持) | |
sceneId | string | 否 | 场景 id (Android端在App 5.10.0及以上版本支持) | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
请求示例
openEditScene({
devId: "devId"
sceneId: "sceneId"
}).then(() => {
console.log('调用成功打开创建场景页面');
});
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。