话不多说 直接上代码!!!
html中得先引用wangEditor插件
vue中使用:
1.npm install wangeditor (注意 wangeditor 所有是小写字母)html
2.引入import E from “wangeditor”; //引入富文本插件
或者
直接引用wangEditor的js
//html中
<div id="editor" v-model="Form.showContent">
<!-- <p>欢迎使用 <b>wangEditor</b> 富文本编辑器</p> -->
</div>
js中先创建富文本
init() {
const E = window.wangEditor;
this.editor = new E(document.getElementById('editor'));
this.editor.customConfig.uploadImgMaxSize = 10 * 1024 * 1024; // 将图片大小限制为 10M
this.editor.customConfig.uploadImgMaxLength = 1; // 限制一次最多上传 1 张图片
this.editor.customConfig.showLinkImg = false;