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 界面

    • showToast 显示 Toast
    • showModal 显示对话框
    • hideKeyboard 隐藏软键盘
    • showLoading 打开原生loading
    • hideLoading 关闭原生loading
    • setStatusBar 设置状态栏样式
    • hideStatusBar
    • takePhoto 拍照功能
      • likeAnimation
      • dismissFullPage 退出全面屏(仅安卓)
    • Device 设备

    • Bluetooth 蓝牙

    • Wifi WiFi

    • HomeManage 家庭管理

    • RoomManage 房间管理

    • Media 媒体

    • Location 定位

    • Encryption 加/解密

    • FileStorage 文件/存储

    • Http 网络/请求

    • weather 天气信息

    • Siri

    • TelPhone

    请扫码查看示例

    # takePhoto ^7.8

    拍照功能,并返回相片数据

    # 请求参数

    Prop Type Default Comment
    compressRage Number N/A 返回照片的压缩率,范围为 0~100(只是针对 jpg 格式的图片,png 格式没有压缩率),数值越高保真率越高。默认值:100
    type String N/A 值为 jpg 或 png,指定返回相片的格式,默认值:jpg
    isNeedBase64 Boolean N/A 是否需要返回相片 base64 数据, 默认值 true

    # 引入接口模块

    import bridge from '@minix-iot/etsbridge-sdk'
    
    1

    # 接口调用示例

    const params = {
      compressRage: 80, //返回照片的压缩率,范围为0~100(只是针对jpg格式的图片,png格式没有压缩率),数值越高保真率越高。默认值:100
      type: 'jpg', //值为jpg或png,指定返回相片的格式,默认值:jpg
      isNeedBase64: true, // true/false //是否需要返回相片base64数据, 默认值true
    }
    bridge
      .takePhoto(params)
      .then((res) => {
        console.log(res)
      })
      .catch((err) => {
        console.log(err)
      })
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    # 接口返回示例

    {
        "status": "0 拍照成功,1 取消拍照",
        "type": "jpg",
        "data": "如果isNeedBase64为true,则返回相片的base64字符串,返回中带有相应的前缀:\"data:image/jpg;base64,...\"",
        "filePath": "返回相片保存的文件路径",
        "fileName": "保存的文件名",
        "size": "返回相片的文件大小,带小数,单位为Kb"
    }
    
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10