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