vue中 的富文本框使用


vue中用 富文本编辑器的方法
使用npm下载:npm install wangeditor (注意 wangeditor  全部是小写字母
然后在需要使用的页面复制以下代码  

<div id="editorElem" style="text-align:left"></div>
<button v-on:click="getContent">发表</button>
在script中

import from 'wangeditor';
export default {
 name: 'editor',
 data () {
 return {
 editorContent: ''
 }
 },
 methods: {
 getContent: function () {
 console.log(this.editorContent);
 }
 },
 mounted() {
 var editor = new E('#editorElem');
 editor.customConfig.onchange = (html) => {
 this.editorContent = html
 };
 editor.create()
 }
}
效果如下图



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM