页面一 生成图片
uni.canvasToTempFilePath({
canvasId: "target",
success: (res) => {
var path = res.tempFilePath;
console.log(path)
// #ifdef H5
if (this.blob) {
path = this.parseBlob(path);
}
// #endif
setTimeout(() => {
uni.$emit('removeBg', {
path: path,
type: 'ld'
});
this.hideLoading();
uni.navigateBack();
}, 500)
},
fail: (ev) => {
console.log(ev)
},
complete: () => {
uni.hideLoading();
}
});
页面二 使用getImageInfo 获取页面一生成图片信息 会偶发报错
uni.getImageInfo({
src: url,
success: function(img) {
console.log(img);
that.imageUrl = img.path;
that.imageInfo = img;
that.handleImageInfo();
resolve(resolve);
},
fail: function(err) {
console.log(err)
setTimeout(() => {
that.initImageInfo(url)
}, 2000);
}
})
0 个回复