1. 程式人生 > >vue中引入wangEditor富文字編輯器

vue中引入wangEditor富文字編輯器

1.wangEditor —— 輕量級 web 富文字編輯器,配置方便,使用簡單。支援 IE10+ 瀏覽器。
下載wangEditor:npm install wangeditor(英文小寫)

官網:www.wangEditor.com
文件:www.kancloud.cn/wangfupeng/wangeditor3/332599
原始碼:github.com/wangfupeng1988/wangEditor (歡迎 star)

2.vue中使用wangEditor富文字編輯器
(1)新增富文字,id=“editor”

在這裡插入圖片描述

(2)引入wangEditor.js,匯入Editor

在這裡插入圖片描述

(3)建立一個富文字編輯器,設定上傳圖片為Base64形式,隱藏網路圖片,只上傳本地圖片。this.editor.txt.html();是獲取富文字中的內容(id=“editor”–"#editor")

在這裡插入圖片描述
效果圖如下:
在這裡插入圖片描述

(4)點選儲存,把使用者userId和富文字內容傳送到後臺

在這裡插入圖片描述

(5)編輯器效果圖如下:

在這裡插入圖片描述