vue wangEditor上传图片到服务器

npm install wangeditor -D

import E from 'wangeditor';

const editor = new E('#editor');
editor.customConfig.customUploadImg = (files, insert) => {
  const formData = new FormData();
  formData.append('file', files[0]);
  formData.append('path', 'files/ne-icev3-dashboard/content/content/');
  this.$axios._api_gateway.post('/file-service/upload/ali', formData).then(res => {
    const result = res.data;
    if (result.code === '000000') {
      const data = result.data;
      insert(data);
    }
  });
};
editor.create();

你可能感兴趣的:(vue)