因为上传图片接口返回结果与编辑器默认要求格式不一样,查看文档可用customInsert()方法处理
但是通过编辑器上传图片,已经成功将图片上传到服务器,并且有返回结果,返回结果示例:http://localhost:8081/file/8d9c76f6a0ad41bbb0f110def726b547.png(直接是图片地址的链接),但是这个链接我在customInsert的res变量中拿不到,以下是我的编辑器配置的代码,有没有踩过这坑的人,帮我看看问题在哪里?
// 编辑器的配置
const editorConfig = {
placeholder: '请 输 入 文 章 内 容 ...',
autoFocus: true,
MENU_CONF: {
uploadImage: {
// 服务端地址
server: 'http://localhost:8081/file/upload',
// 后端接受文件名
fieldName: "file",
// 图片最大体积(byte)
maxFileSize: 1 * 1024 * 1024,
// 文件类型
allowedFileTypes: ['image/*'],
// 超时时间(ms)
timeout: 6 * 1000,
// 加工上传接口返回数据
customInsert(res, insertFn) {
console.log('customInsert', res)
insertFn(res, '图片消失了!', res)
}
}
}
}