vue-quill-editor 图片拖拽
时间: 2023-11-24 15:38:07 浏览: 150
要实现vue-quill-editor的图片拖拽功能,你需要下载并安装两个插件:quill-image-drop-module和quill-image-resize-module。首先运行以下命令来安装这两个插件:
```
npm install quill-image-drop-module -S //允许粘贴图像并将其拖放到编辑器中
npm install quill-image-resize-module -S //允许调整图像大小
```
接下来,在vue的配置文件中进行以下修改:
```javascript
<template>
<div>
<quill-editor ref="myQuillEditor" @change='onEditorChange' :content="content" :options="editorOption"></quill-editor>
</div>
</template>
<script>
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import { quillEditor } from 'vue-quill-editor';
export default {
data() {
return {
content: '',
editorOption: {
placeholder: '编辑文章内容'
},
}
},
components: {
quillEditor
},
methods: {
onEditorChange({ editor, html, text }) {
this.content = html;
},
}
}
</script>
```
通过以上步骤,你就可以在vue-quill-editor中实现图片拖拽功能了。
阅读全文