# compressImage
压缩图片
# 输入
继承标准对象输入,扩展属性描述
| 名称 | 数据类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| quality | number | 是 | 图片压缩后的质量1~100,100为不压缩 | |
| pathArr | array | 是 | 图片路径,里面每个元素都是对象 {path:"...",width:200,height:300} |
# 输出
继承标准对象输出,无扩展属性
path:压缩后的图片路径,size:压缩后的图片大小
# 示例代码
app.link.compressImage(
80,
[
{
path: res[0].resourceLocal,
width: 200,
height: 300
}
],
res => {
bui.alert(res)
bui.hint('压缩成功');
},
error => {
bui.hint('压缩失败');
);