在vue中獲取wangeditor的html和text的操作
目的:vue 中獲取 wangeditor 的 html 和 text。
補(bǔ)充知識(shí):vue-cli webpack 引入 wangeditor(輕量級(jí)富文本框)
1:使用npm下載:
//(注意 wangeditor 全部是小寫(xiě)字母)
npm install wangeditor
2: 直接在項(xiàng)目模板中引用
import E from ’wangeditor’
3:HTML
<div style='text-align:left'></div>
<button v-on:click='getContent'>查看內(nèi)容</button>
4:js代碼
export default { name: ’editor’, data () { return { editorContent: ’’ } }, methods: { getContent: function () { alert(this.editorContent) } }, mounted() { var editor = new E(’#editorElem’) editor.customConfig.onchange = (html) => { this.editorContent = html } editor.create() } }
5:哈哈 然后就搞定啦 附錄 原作者github 地址
https://github.com/wangfupeng1988/wangEditor/blob/master/README.md
以上這篇在vue中獲取wangeditor的html和text的操作就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 每日六道java新手入門(mén)面試題,通往自由的道路第二天2. python b站視頻下載的五種版本3. 解決Java中的java.io.IOException: Broken pipe問(wèn)題4. 測(cè)試模式 - XSL教程 - 55. Python結(jié)合百度語(yǔ)音識(shí)別實(shí)現(xiàn)實(shí)時(shí)翻譯軟件的實(shí)現(xiàn)6. 《CSS3實(shí)戰(zhàn)》筆記--漸變?cè)O(shè)計(jì)(一)7. JAVA抽象類(lèi)及接口使用方法解析8. 讓chatgpt將html中的圖片轉(zhuǎn)為base64方法示例9. python如何寫(xiě)個(gè)俄羅斯方塊10. 教你JS更簡(jiǎn)單的獲取表單中數(shù)據(jù)(formdata)
