Ba-ImageEditor 是一款功能强大的uniapp图片编辑插件,支持涂鸦、滤镜、裁剪、旋转、添加文字、美颜等等。
可与 图片选择插件 Ba-MediaPicker 搭配使用。(文档)
在 script
中引入组件
const imageEditor = uni.requireNativePlugin('Ba-ImageEditor')
在 script
中调用
methods: {
imageEdit() {
imageEditor.imageEdit({
'path': this.path,//原始图片路径
'outputPath': this.outputPath,//保存图片路径
},
(ret) => {
console.log(ret)
if (ret.outputPath && ret.isImageEdit) {
this.path = ret.outputPath;
}
});
},
}
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
path | String | ‘’ | 原始图片路径,不能为空 |
outputPath | String | /storage/emulated/0/Pictures/BaImageEditor/tietu{时间毫秒}.png | 保存图片路径 |
属性名 | 类型 | 说明 |
---|---|---|
isImageEdit | Boolean | 是否编辑图片 |
outputPath | String | 图片编辑输出目录 |