实现效果
1.安装插件 npm install vue-quill-editor --save
2.安装成功后在package.json中查看
3.在main.js中全局引入插件
// 富文本编辑器import VueQuillEditor from 'vue-quill-editor'import 'quill/dist/quill.core.css'import 'quill/dist/quill.snow.css'import 'quill/dist/quill.bubble.css'Vue.use(VueQuillEditor)
4.页面实现
<template><div class="body"><h2>富文本编辑器</h2><quill-editor ref="text" v-model="content" class="editor" :options="editorOption"/><el-button class="button" @click="onEditor">提交</el-button></div></template><script>export default {data() {return {content: "",editorOption: {},};},methods: {onEditor() {console.log("富文本内容=",this.$refs.text.value);},},};</script><style lang="less" scoped>.body {height: 700px;.editor {height: 500px;}.button {margin-left: 50%;margin-top: 50px;}}</style>
感谢老哥:ElementUI生成富文本编辑器/keplerm/article/details/123379511?spm=1001.2101.3001.6650.9&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-123379511-blog-125430395.235%5Ev36%5Epc_relevant_anti_vip_base&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-123379511-blog-125430395.235%5Ev36%5Epc_relevant_anti_vip_base&utm_relevant_index=18/keplerm/article/details/123379511?spm=1001.2101.3001.6650.9&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-123379511-blog-125430395.235%5Ev36%5Epc_relevant_anti_vip_base&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-9-123379511-blog-125430395.235%5Ev36%5Epc_relevant_anti_vip_base&utm_relevant_index=18
简版的富文本编辑器 VUE+ElementUI 富文本编辑器 element ui富文本编辑器的使用(quill-editor) 不好用你来打我!全网醉简单!要复杂的别来!