0.1.7 • Published 4 years ago

awesome-vue-editor v0.1.7

Weekly downloads
2
License
MIT
Repository
-
Last release
4 years ago

awesome-vue-editor

安装

npm install awesome-vue-editor --save

使用

全局引用

在Vue项目中,在main.js文件中加入以下代码

import VEditor from 'awesome-vue-editor'
Vue.user(VEditor)

在其它组件中就可以使用

  <v-editor v-model="content" 配置...></v-editor>

配置

属性配置

属性类型默认值是否必填项说明
v-modelString你组件中绑定的编辑器输入内容
heightNumber | String"300px"编辑器高度
widthNumber | String100%编辑器宽度
editabledBooleantrue编辑器是否可以编辑
countWordsBooleantrue字数统计
autoHeightEnabledBooleanfalse编辑器是否自动增加高度
maxWordNumber10000编辑器最大字数
optionsObject详见option项配置编辑器所有配置

options项配置

属性配置的优先级大于option里的配置内容

属性类型默认值说明
toolbarsArray详见工具栏配置可以是一维数组,也可以是2维数组,二维数组是给工具栏进行分组
heightNumber | String"300px"编辑器高度
widthNumber | String100%编辑器宽度
editabledBooleantrue编辑器是否可以编辑
countWordsBooleantrue字数统计
autoHeightEnabledBooleanfalse编辑器是否自动增加高度
fontNameObject详见字体配置
fontsizeObject详见字号配置
maxWordNumber10000编辑器最大字数

工具栏配置

可以是一维数组,也可以是2维数组,二维数组是给工具栏进行分组

    toolbars: [
      ['undo'],
      ['fontName', 'fontsize'],
      ['bold', 'italic', 'underline', 'strikeThrough'],
      ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
      ['indent', 'outdent'],
      ['foreColor', 'backColor', 'removeFormat', 'lineHeight'],
      ['insertHorizontalRule', 'insertImage', 'insertHTML'],
      ['insertOrderedList', 'insertUnorderedList'],
      ['subscript', 'superscript'],
      ['createLink', 'unlink']
    ]

字体项配置

  fontName: {
    // 文本:值
    '宋体': 'SimSun',
    '黑体 ': 'SimHei',
    '微软雅黑': 'Microsoft YaHei',
    '仿宋 ': 'FangSong',
    '楷体': 'KaiTi',
    ......
  }

字号项配置

fontsize: {
    // 文本:值
    '二号': '22pt',
    '小二': '18pt',
    '三号': '16pt',
    '小三': '15pt',
    '四号': '14pt',
    '小四': '12pt',
    '五号': '10pt',
    ......
  }

代码仓库

See github.com.

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago