安装

npm install vue-quill-editor --save

挂载 vue-quill-editor 插件

全局挂载

import Vue from 'vue'
import VueQuillEditor from 'vue-quill-editor'
// require styles 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor, /* { default global options } */)

局部挂载

// require styles 导入富文本编辑器对应的样式
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 {components: {quillEditor}
}

页面使用

<template>
<div><!-- Two-way Data-Binding --><quill-editorref="myQuillEditor"v-model="content":options="editorOption"@blur="onEditorBlur($event)"@focus="onEditorFocus($event)"@ready="onEditorReady($event)"/><!-- Or manually control the data synchronization --><quill-editor:content="content":options="editorOption"@change="onEditorChange($event)"/>
</div>
</template><script>export default {data () {return {content: '<h2>I am Example</h2>',editorOption: {placeholder: '请在这里输入',modules: {toolbar: [['bold', 'italic', 'underline', 'strike'], // 加粗,斜体,下划线,删除线// ['blockquote', 'code-block'], // 引用,代码块[{ header: 1 }, { header: 2 }], // 标题,键值对的形式;1、2表示字体大小[{ list: 'ordered' }, { list: 'bullet' }], // 列表[{ script: 'sub' }, { script: 'super' }], // 上下标[{ indent: '-1' }, { indent: '+1' }], // 缩进[{ direction: 'rtl' }], // 文本方向[{ size: ['small', 'large', 'huge'] }], // 字体大小[{ header: [1, 2, 3, 4, 5, 6, false] }], // 几级标题[{ color: [] }, { background: [] }], // 字体颜色,字体背景颜色[{ font: [] }], // 字体[{ align: [] }], // 对齐方式['clean'], // 清除字体样式['link'] //, 'image', 'video']}},}},methods: {onEditorBlur(quill) {console.log('editor blur!', quill)},onEditorFocus(quill) {console.log('editor focus!', quill)},onEditorReady(quill) {console.log('editor ready!', quill)},onEditorChange({ quill, html, text }) {console.log('editor change!', quill, html, text)this.content = html}},computed: {editor() {return this.$refs.myQuillEditor.quill}},mounted() {console.log('this is current quill instance object', this.editor)}
}
</script>

结果

Vue中使用quill富文本相关推荐

  1. vue中使用quill富文本编辑器

    因为公司的需求,对比了线在很火的几款富文本编辑器,最终选定了quill,他够轻量,拓展性也比较高,除了文档是英文的阅读不方便之外,都很适合公司项目.故整理出来,也方便以后使用. 在网上找了一个中文文档 ...

  2. Vue 中引入markdown富文本编辑器并根据md格式渲染

    Vue 中引入markdown富文本编辑器 在vue组件中,比较好用的是mavon-editor,github文档地址 https://github.com/hinesboy/mavonEditor ...

  3. Vue中使用vue-quil-editor富文本编辑器+el-upload实现带图片上传到SpringBoot后台接口

    场景 系统中经常会用到富文本编辑器,比如新增通知和公告功能,并且需要添加上传图片. vue-quill-editor官网: https://www.npmjs.com/package/vue-quil ...

  4. 在Vue中使用Tinymce富文本编辑器+上传图片到七牛

    公司官网后台需要做一个上传新闻.公告的功能,自然而然就需要用到了富文本编辑器. UEditor.Simditor.wangEditor.CKEditor.TinyMCE.Quill,这是当前比较热门的 ...

  5. Vue中使用Wangeditor富文本实现聊天发送文件驻留

    1.最近遇到一个需求,类似企业微信发送文件及视频时可以在文本框内驻留,然后点击发送按钮进行文件发送,这里使用的是富文本框进行处理,Wangeditor富文本框. 自定义添加菜单功能如下: cnpm i ...

  6. vue中使用wangeditor富文本编辑器(含图片上传和回显)

    最近在写vue的项目中,遇到一个需求,点击编辑,显示弹框,在弹框中的富文本编辑器中编辑自定义文本样式,可以上传图片并回显.编辑完成确定后显示在页面上. 首先先写一个editor.vue的页面.(建议单 ...

  7. vue中使用element-tiptap富文本编辑器

    element-tiptap富文本编辑器 npm安装 npm install element-tiptap --save yarn安装 yarn add element-tiptap 全局引入 imp ...

  8. 在Vue中使用CKEditor5富文本编辑器

    在项目中遇到富文本编辑器需要实现粘贴图片的功能,使用场景:如用户在其他地方截图可以直接在富文本编辑器内粘贴. 找了一圈市面上开源免费的富文本编辑器,最后选中CKEditor.ckeditor  doc ...

  9. vue中使用tinymce富文本

    安装 方式一: npm install @tinymce/tinymce-vue -S npm install tinymce -S 方式二: 将下面的配置粘到package.json文件depend ...

最新文章

  1. C++11中std::shared_future的使用
  2. 在myeclipse文件中如何创建properties类型的文件,从而连接数据库
  3. 使用python用什么软件-python开发工具有哪些(初学python用什么软件)
  4. 手机/移动前端开发需要注意的20个要点
  5. nth-of-type
  6. DCMTK:测试衍生图像FG类
  7. [css] 你是如何规划响应式布局的?
  8. html5游戏开发box2djs,Box2D.js简易示例
  9. spring boot Exception in Thread “main” java.lang.classNoFoundException
  10. 20 WM配置-策略-定义出库排序序列(拣配)
  11. Java 中 Comparable 和 Comparator 比较(转)
  12. Linux下安装PHP扩展
  13. vnpy 量化交易系统 源码分析 v0.01
  14. 计算机网络应用基础的题,计算机网络应用基础试题
  15. 求解马走棋问题(回溯法)
  16. 2015出现神曲空挡期,玖月奇迹接棒筷子兄弟?
  17. PM的基石(1) - PMP (国际项目管理师)
  18. XMind8.0介绍与安装(破解)
  19. 转 -- Zynga:从Amazon公共云到zCloud私有云
  20. mysql用int做时间戳存储,最大2147483647, 大限2038年

热门文章

  1. java实现MD5加密和解密
  2. Python学习,元类type 反射 函数与方法 双下方法
  3. Python 08-文件读写
  4. HDOJ2955 Robberies(01背包,概率)
  5. FICO配置详解之五:内部订单管理
  6. 创业时全力以赴和留有后路的结果相同吗?
  7. 学了php能做什么工作吗,学会ps能做什么工作
  8. 工商局爬虫 商标网爬虫
  9. python外星人游戏制作
  10. 【STM32CubeIDE】将变量定义到指定地址