# choosePhoto
选择相册照片,并返回相片数据
# 接口调用示例
this.$bridge
.choosePhoto(params)
.then(res => {
this.$alert(res)
})
.catch(err => {
this.$toast(err)
})
1
2
3
4
5
6
7
8
9
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: 指定返回相片的格式(值为 jpg 或png } isNeedBase64: {Type: Boolean, Default: true, Description: 是否需要返回相片base64数据: true 是 / false 否} | 请求参数 |
# 返回参数
- 成功时返回
Prop | Type | Default | Description |
---|---|---|---|
status | Number | 0 /1 | 0 拍照成功 /1 取消拍照 |
type | String | N/A | 指定返回相片的格式(值为jpg 或png ) |
data | String | N/A | 如果isNeedBase64 为true ,则返回相片的base64字符串 |
filePath | String | N/A | 返回相片保存的文件路径 |
fileName | String | N/A | 保存的文件名 |
size | Number | N/A | 返回相片的文件大小,带小数,单位为Kb |
- 失败时返回
Prop | Type | Default | Description |
---|---|---|---|
errorCode | Number | N/A | 请求失败错误码:-1 没有权限 |