mc.chooseImage(Object object)

从本地相册选择图片或使用相机拍照

Object object 参数

属性 类型 默认值 必填 说明
count Number 9 最多可以选择的图片张数
sizeType [String] ['original', 'compressed'] 所选的图片的尺寸
sourceType [String] ['album', 'camera'] 选择图片的来源
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

Object.sizeType 的合法值

说明
original 原图
compressed 压缩图

Object.sourceType 的合法值

说明
album 从相册选图
camera 使用相机

Object.success(Object res) 回调函数

属性 类型 说明
tempFilePaths [String] 图片的本地临时文件路径列表 (本地路径)
tempFiles [Object] 图片的本地临时文件列表

res.tempFiles 的结构

属性 类型 说明
path String 本地临时文件路径 (本地路径)
size Number 本地临时文件大小,单位 B

示例代码:

mc.chooseImage({
  sizeType: [ 'original', 'compressed'],
  sourceType: ['album','camera'],
  complete: function (res) {
    console.log(res.tempFilePaths[0])
  }
})

results matching ""

    No results matching ""

    results matching ""

      No results matching ""