wangeditor文档中示例的自定义函数上传方法是
editor.config.customUploadImg = function (resultFiles, insertImgFn) {
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
// 上传图片,返回结果,将图片插入到编辑器中
insertImgFn(imgUrl)
}
这个函数不是箭头函数,所以this指向是editor.config.customUploadImg这个函数。
解决办法就是改为箭头函数形式,如下
editor.config.customUploadImg = (resultFiles, insertImgFn)=>{}