【问题标题】:What should I put in the imageUpload of the redactor Parameter?我应该在 redactor 参数的 imageUpload 中放入什么?
【发布时间】:2020-06-22 07:44:04
【问题描述】:

我目前使用 vue 作为前端,django 作为后端。 我在前端vue中使用redactor的编辑器,但是不知道在imageUpload中放什么。 我应该放后端的API吗?这是我当前的代码。

  configOptions = {
    buttons: ['format', 'bold', 'italic', 'lists', 'link', 'image', 'file'],
    plugins: ['imagemanager', 'filemanager']
    imageUpload:
      'http://backend-url/image/',
    imageData: {
      id: 10,
      elements: '#my-input, #my-form'
    }
  }

【问题讨论】:

标签: vue.js nuxt.js wysiwyg redactor


【解决方案1】:

您可以使用 imageUpload 上传与文本内联的图片。要添加图像,您可以向 imageUpload 添加一个函数,将图像提交到您的数据库或 vuex 存储。例如;

imageUpload: (data, files, e, upload) => {
    // commit to your vuex store, or do a post request to your API url.                  
},

【讨论】:

  • 非常感谢!你对我很有帮助!我还有一个问题。我检查了 imageUpload 函数的响应,但是如果我添加图片,我在编辑器中看不到图片。我该怎么办?
  • 你能告诉我在哪里可以看到关于 vue redactor 的 imageManger 的信息吗?
  • @Rebbeca “我在编辑器中看不到图片”是什么意思?你没有得到回应?
  • 有响应,但照片没有显示。但这是一个由于未从服务器接收到 url 而导致的错误。谢谢!上传图片时,编辑器是否总是必须将图片发送到服务器?写完帖子不能一次性把所有图片发到服务器吗?
猜你喜欢
  • 2021-06-15
  • 2013-07-30
  • 2019-09-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-30
  • 1970-01-01
  • 2013-08-13
相关资源
最近更新 更多