vue富文本编辑器

  • A+
所属分类:Web前端
摘要

npm i wangeditor –save
页面单独引入
import E from “wangeditor”;

<div id=”div1″></div>

data(){
  return{
    editor:null,
  }
}

mounted() {
  const editor = new E(‘#div1’);
  // 配置 onchange 回调函数,将数据同步到 vue 中
  editor.config.onchange = (newHtml) => {
    this.ruleForm.activity_content = newHtml;
  }
  editor.create();
  this.editor = editor;
},

其他操作可查看官方文档:http://www.wangeditor.com/index.html

npm i wangeditor --save
页面单独引入
import E from "wangeditor";

<div id="div1"></div>

data(){
  return{
    editor:null,
  }
}

mounted() {
  const editor = new E('#div1');
  // 配置 onchange 回调函数,将数据同步到 vue 中
  editor.config.onchange = (newHtml) => {
    this.ruleForm.activity_content = newHtml;
  }
  editor.create();
  this.editor = editor;
},

其他操作可查看官方文档:http://www.wangeditor.com/index.html