亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術(shù)文章
文章詳情頁

Vue中使用wangeditor富文本編輯的問題

瀏覽:84日期:2022-10-05 18:15:05

wangEditor是基于javascript和css開發(fā)的 Web富文本編輯器, 輕量、簡潔、易用、開源免費。在我們實際項目上還是比較頻繁應用到的,下面出個案例供大家參考學習…

wangEditor文檔:https://www.wangeditor.com/

富文本編輯器截圖:

Vue中使用wangeditor富文本編輯的問題Vue中使用wangeditor富文本編輯的問題Vue中使用wangeditor富文本編輯的問題

<!--富文本編輯器。http://www.wangeditor.com/使用示例:<AppEditor v-model='content'></AppEditor>--><template> <article ref='editor' class='AppEditor-root'></article></template><script> const E = require(’wangeditor’); export default { name: ’AppEditor’, model: { prop: ’value’, event: ’update:value’, }, props: { // value值,v-model綁定 value: {type: String, default: ’’}, // 菜單選項 menus: { type: Array, default(){ return [ ’bold’, // 粗體 ’italic’,//斜體 ’underline’,//下劃線 ’fontSize’, // 字號 ’strikeThrough’,//刪除線 ’image’, // 插入圖片 ’undo’, // 撤銷 // ’fontName’, // 字體 // ’italic’, // 斜體 // ’underline’, // 下劃線 // ’strikeThrough’, // 刪除線 // ’foreColor’, // 文字顏色 // ’backColor’, // 背景顏色 // ’link’, // 插入鏈接 // ’list’, // 列表 // ’justify’, // 對齊方式 // ’quote’, // 引用 // ’emoticon’, // 表情 // ’image’, // 插入圖片 // ’table’, // 表格 // ’video’, // 插入視頻 // ’code’, // 插入代碼 // ’undo’, // 撤銷 // ’redo’, // 重復 ]; }, }, }, data(){ return { editor: {}, // 編輯器對象 _value: ’’, // 內(nèi)容備份,用于watch時候判斷,只在編輯器輸入時改變 }; }, computed: {}, mounted(){ this.initEditor(); }, watch: { value(newValue, oldValue){ // 編輯器onchange更改的不處理,只處理父組件傳來的,防止文字回退bug if (newValue != this._value) { this.editor.txt.html(newValue); } }, }, methods: { initEditor(){ let editor = new E(this.$refs.editor); Object.assign(editor.customConfig, { menus: this.menus, zIndex: 100, height: 200, pasteFilterStyle: false, onchange: (html) => { this._value = html; // 更新 _value this.$emit(’update:value’, html); // 更新 value }, customUploadImg:((file, insert)=> { if(this.$utils.isEmpty(file)){ return; } const msg = this.$Message.loading({ content: ’親,圖片正在拼命地上傳中,請稍等...’, duration: 0 }); var params = new FormData(); params.append(’img’, file[0]); this.$api.post(’/synthesis/crm/picture/pictureUpload’,params).then(res => { insert(res.data.imgUrl) setTimeout(msg, 0); this.$Message.success(’上傳成功’); }) }), uploadImgHooks:{ customInsert: function (insertImg, result, editor) { insertImg(result.url) } } }); editor.create(); editor.txt.html(this.value); // 針對數(shù)據(jù)異步獲取的這里無法立即綁定,在watch判斷處理 this.editor = editor; }, }, };</script><style scoped lang='scss'> .AppEditor-root{ border: 1px solid #f0f0f0; height: 400px !important; /deep/ .w-e-toolbar{ border: none !important; border-bottom: 1px solid #f0f0f0 !important; background-color: #fff !important; } /deep/ .w-e-text-container{ height: calc(100% - 43px) !important; border: none !important; z-index:1 !important; .w-e-text{ height: 100%; overflow-y: auto !important;} } }</style>

到此這篇關(guān)于Vue中使用wangeditor富文本編輯的問題的文章就介紹到這了,更多相關(guān)wangeditor富文本編輯內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 正在播放的国产a一片 | 亚洲欧美日韩在线观看你懂的 | 精品久久一区二区三区 | 毛片黄在线看免费 | 1级黄色毛片| 欧美一级欧美三级 | 国产视频福利在线 | 久久综合欧美 | xvideos最新亚洲入口 | 激情视频亚洲 | 最新欧美精品一区二区三区 | 韩国一大片a毛片女同 | 亚洲色图88 | 国产黄色在线 | 国产成人在线播放 | 国产女人综合久久精品视 | 手机看片自拍 | 亚洲国产午夜看片 | 午夜国产 | 国产精品日韩欧美在线 | 日本国产免费一区不卡在线 | 日本一二三精品黑人区 | 欧美3p在线观看 | 黄色综合网站 | 8x成人在线 | 嫩草视频在线观看 | 免费超爽大片黄网站 | 成人影片在线播放 | 国产一区二区三区四区20p | 精品三级国产 | 美国黄色免费网站 | 美女吊黑视频在线观看 | 99视频在线观看视频一区 | 国产亚洲综合视频 | 色偷偷综合网 | 久久精品国产一区二区三区 | 免费尤物视频 | 亚洲欧美成人永久第一网站 | 成人久久18免费网址 | 国产女乱淫真高清免费视频 | 精品国产亚洲一区二区在线3d |