wxparse转化图片为base64时报错,应将富文本编辑中的图片改为url方式上传
wx.chooseImage({
count: 9,
sizeType:['original','compressed'],
sourceType:['album','camera'],
success(res){
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths;
// for(let i=0;i
wx.uploadFile({
url: api.upload,//仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
formData: {
token:wx.getStorageSync('token'),
type: that.type
},
success(res1){
// const data = res.data
let data = JSON.parse(res1.data);
//do something
that.editorCtx.insertImage({
src: api.api + data.data,
data: {
id: '',
role: ''
},
success: function(){
console.log('insert image success')
}
})
that.$apply();
}
})
// }
}
})