quill-editor使用方法,图片base64位转为url缩减字符长度,以及显示文字个数,光标位置等

  1. 下载
npm install vue-quill-editor

2.导入

import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import { quillEditor } from 'vue-quill-editor'

3.使用

 <!-- 富文本 -->
            <div class="editor-wrapper">
              <!-- 改进quill的图片base64功能,改为上传后拼接url,上传组件隐藏 -->
              <el-upload
                class="quill-upload"
                :action="photoUploadUrl"
                :show-file-list="false"
                :on-success="handleQuillImgSuccess"
                with-credentials
                accept="image/gif, image/jpeg, image/jpg, image/bmp, image/png"
                style="display: none">
                <i id="imgInput" class="el-icon-plus avatar-uploader-icon" />
              </el-upload>
              <!--  -->
              <quill-editor ref="myQuillEditor" v-model="form.CONTENT" @change="onEditorChange($event)" :disabled="contentModel" :options="editorOption" />
              <span class="size-tip">
                {
  
  {TiLength}}/500
              </span>
            </div>

4.赋值与方法

const toolbarOptions = [
        ['bold', 'italic', 'underline', 'strike'], // toggled buttons
        ['blockquote', 'code-block'],

        [{
   
    header: 1 }, {
   
    header: 2 }], // custom button values
        [{
   
    list: 'ordered' }, {
   
    list: 'bullet' }],
        [{
   
    script: 'sub' }, {
   
    script: 'super' }], // superscript/subscript
        [{
   
    indent: '-1' }, {
   
    indent: '+1' }], // outdent/indent
        [{
   
    direction: 'rtl' }], // text direction

        [{
   
    size: ['small', false, 'large', 'huge'] }], // custom dropdown
        [{
   
    header: [1, 2, 3, 4, 5, 6, fals
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值