1、解决跨域问题  https://blog.csdn.net/Tomwildboar/article/details/82901514

2、前台页面

wangeditorInit() {   //初始化编辑器
                
                var editor = new E('#div1', '#div2')  // 两个参数也可以传入 elem 对象,class 选择器
                // 自定义表情
                // editor.customConfig.emotions = this.emoji
                //同步数据 
                editor.customConfig.onchange = (html) => {
                    this.inputBlog.bcontext = html;
                    this.inputBlog.babstract = editor.txt.text();
                }
                editor.customConfig.uploadImgServer = 'http://127.0.0.1:8080/saveWangeditorImg'
                editor.customConfig.withCredentials = true
                editor.customConfig.uploadFileName = 'myFileName'
                editor.customConfig.uploadImgMaxSize = 20 * 1024 * 1024
           
                editor.create();              
            }

3、获取 token 代码(你也可以直接整合到上传后台)

https://blog.csdn.net/Tomwildboar/article/details/82959736

4、后台上传

//保存 wangeditor 中的图片
    @RequestMapping(value = "/saveWangeditorImg",method = RequestMethod.POST)
    public String uploadQiNiu(@RequestParam("myFileName") MultipartFile myFileName) throws Exception{

        InputStream stream = myFileName.getInputStream();
        //构造一个带指定Zone对象的配置类
        Configuration cfg = new Configuration(Zone.zone0());
        //...其他参数参考类注释
        UploadManager uploadManager = new UploadManager(cfg);
        //调用上面 获取 token 的方法
        QiNiu token = getToken();
        Response response = uploadManager.put(stream,token.getKey(),token.getToken(),null, null);
        //解析上传成功的结果
        DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
        //图片路径
        String url = "http://qiniu.xdx97.com/"+token.getKey();
        return "{\"errno\":0,\"data\":[\""+url+"\"]}";
    }