# choosePhoto

选择相册照片,并返回相片数据

# 接口调用示例


this.$bridge
    .choosePhoto(params)
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })
1
2
3
4
5
6
7
8
9

# 请求参数

Prop Type Required Default Description
param Object Y {}
属性:
compressRage:{
Type: Number,
Default: 100,
Description: 返回照片的压缩率,范围为0~100(只是针对jpg格式的图片,png格式没有压缩率),数值越高保真率越高
}
type:{
Type: String,
Default: jpg,
Description: 指定返回相片的格式(值为jpgpng
}
isNeedBase64:{
Type: Boolean,
Default: true,
Description: 是否需要返回相片base64数据:true是 / false
}
请求参数

# 返回参数

  • 成功时返回
Prop Type Default Description
status Number 0/1 0 拍照成功 /1 取消拍照
type String N/A 指定返回相片的格式(值为jpgpng
data String N/A 如果isNeedBase64true,则返回相片的base64字符串
filePath String N/A 返回相片保存的文件路径
fileName String N/A 保存的文件名
size Number N/A 返回相片的文件大小,带小数,单位为Kb
  • 失败时返回
Prop Type Default Description
errorCode Number N/A 请求失败错误码:-1 没有权限
Last Updated: 10/27/2020, 4:35:43 PM