vue-quill-editor使用

导入

import 'quill/dist/quill.core.css' import 'quill/dist/quill.snow.css' import 'quill/dist/quill.bubble.css' import VueQuillEditor, { quillEditor } from 'vue-quill-editor' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' window.Quill.register('modules/imageDrop', ImageDrop) window.Quill.register('modules/imageResize', ImageResize)

简单配置项
data () { return { editorOption: { placeholder: '请输入内容...', modules: { toolbar: [ [{ 'size': ['small', false, 'large'] }], ['bold', 'italic'], [{ 'list': 'ordered' }, { 'list': 'bullet' }], ['link', 'image'] ], history: { delay: 1000, maxStack: 50, userOnly: false }, imageDrop: true, imageResize: { displayStyles: { backgroundColor: 'black', border: 'none', color: 'white' }, modules: ['Resize', 'DisplaySize', 'Toolbar'] } } } } }

使用组件

设置简单样式
.quill-editor:not(.bubble) .ql-container, .quill-editor:not(.bubble) .ql-container .ql-editor { height: 15rem; padding-bottom: 1rem; } .ql-toolbar.ql-snow { height: 44px; line-height: initial; }

注意!!! 【vue-quill-editor使用】需添加配置如下(以vue3.0为例)
configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill' }) ] }

    推荐阅读