一、效果图展示
模拟器及pc 端效果图 手机端就不贴了

二、把官方示例copy到自己的项目传送门

三、改一改上传图片功能
insertImage() {
const that = this
wx.chooseImage({
success: function (response) {
response.tempFilePaths.map(item => {
wx.uploadFile({
url: '上传图片api',
name: 'file',
formData: {
systemId: '49603D09F8B64F068F77B7FC965410E0'
},
filePath: item,
success: res => {
that.editorCtx.insertImage({
src: JSON.parse(res.data).data.url,
data: {
id: 'abcd',
role: 'god'
},
width: '80%',
success: function () {
console.log('insert image success')
}
})
},
fail: err1 => {
console.log(err1, '是比啊了');
}
})
})
},
fail: err => {
console.log(err, '你失败了'