1.先安装依赖包:npm install vue-quill-editor
2.在main.js中引入富文本编辑器
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
2.在需要的组件中引入富文本
import { quillEditor } from 'vue-quill-editor'
3.注册组件components: {quillEditor}
4.在视图中使用富文本编辑器
<quill-editor
:content=“content”
:options="editorOption"
@change="onEditorChange($event)"
/>
5.所需要的的配置
data(){
return{
content:'',
editorOption:{}
}
},
6.在方法中调用
onEditorChange({quill,html,text}){
console.log(‘editor change!’,quill,html,text);
this.content=html
}