MiniX自绘渲染跨平台框架
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 框架说明
  • 声明式开发范式
  • 内置Api
指南
接口
  • Minix CLI
示例
  • 类Web框架

    • 框架说明
    • 类Web开发范式
    • 内置Api
  • 指南
  • 组件
  • 接口
  • 示例
  • 规范
  • DophinHybrid

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • DolphinWeex

    • 快速上手 (opens new window)
    • UI 组件库 (opens new window)
    • jsBridge 接口 (opens new window)
  • 发布消息
  • 常见问题
  • 更新日志
  • 快速上手
    • Basic 基础

    • Account

    • UI 界面

    • Device 设备

    • Bluetooth 蓝牙

    • Wifi WiFi

    • HomeManage 家庭管理

    • RoomManage 房间管理

    • Media 媒体

    • Location 定位

    • Encryption 加/解密

    • FileStorage 文件/存储

    • Http 网络/请求

    • weather 天气信息

    • Siri

    • TelPhone

    # 安装

    # 一. 安装包

    • npm 安装
    npm i -S @minix-iot/etsbridge-sdk  或者 npm install @minix-iot/etsbridge-sdk --save
    
    
    1
    2
    • yarn 安装
    
    yarn add @minix-iot/etsbridge-sdk
    
    
    1
    2
    3
    • 升级接口模块

    • 使用 cnpm install -S + 模块name + 版本号,推荐使用 cnpm,此处使用 npm 在部分版本下有问题。

    # 升级到最新版本
    
        cnpm install -S @minix-iot/etsbridge-sdk@latest
    
    # 升级到指定版本,例如:
    
        cnpm install -S @minix-iot/etsbridge-sdk@ + 版本号
    
    # 使用1.0.2版本:
    
        cnpm install -S @minix-iot/jsbridge-sdk@1.0.2
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    • 手动修改package.json文件下的模块的版本号,然后执行以下命令:
    cnpm install(推荐)
    #或者
    npm update
    #或者
    npm install
    
    
    1
    2
    3
    4
    5
    6

    # 二. 使用

    // 引入bridge模块
    import bridge from '@minix-iot/etsbridge-sdk'
    // 使用(以canIUse接口为例)
    let params = 'getSystemInfo'
    bridge
      .canIUse(params)
      .then((res) => {
        // 接口成功返回
        console.log(res)
      })
      .catch((err) => {
        // 接口失败返回
        console.log(err)
      })
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

    注:

    如果 npm 安装较慢,可以切换到淘宝源,使用 cnpm 安装

    切换到淘宝镜像:npm config set registry https://registry.npmmirror.com