在GOFLY项目的实现过程中,需要使用富文本编辑器,现在使用下wangEditor
很简单,先引入
<script src="https://cdn.jsdelivr.net/npm/wangeditor@latest/dist/wangEditor.min.js"></script>
再使用
html中
<div id="welcomeEditor"></div>
在methods方法中加入
initEditor(){if(this.editor!=null){return;}const E = window.wangEditorthis.editor = new E('#welcomeEditor')this.editor.config.height = 240;this.editor.config.menus = ['head','bold','fontSize','fontName','italic','underline','strikeThrough','indent','lineHeight','foreColor','backColor','link','justify','emoticon','table','splitLine','undo','redo',]this.editor.create();}},
获取html内容
this.editor.txt.html();