成人视屏在线观看-国产99精品-国产精品1区2区-欧美一级在线观看-国产一区二区日韩-色九九九

您的位置:首頁技術文章
文章詳情頁

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

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

wangEditor是基于javascript和css開發的 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: ’’, // 內容備份,用于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); // 針對數據異步獲取的這里無法立即綁定,在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>

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

標簽: Vue
相關文章:
主站蜘蛛池模板: 色在线免费视频 | 三级网站在线 | 女人张开腿让男人操 | 午夜在线播放免费人成无 | 特级欧美视频aaaaaa | 手机毛片在线 | 欧美日本一区二区三区 | 久久的精品99精品66 | 很黄很暴力深夜爽爽无遮挡 | 午夜久久久久久久 | 一区二区三区欧美视频 | 成年女人看片免费视频播放器 | 九九视频在线 | 久草视频免费看 | a男人的天堂久久a毛片 | 国产欧美日韩在线观看精品 | 91色老99久久九九爱精品 | 99re久久资源最新地址 | 香港a毛片免费全部播放 | 久久久久综合 | 99在线精品免费视频 | 免费中国一级啪啪片 | 日韩天天摸天天澡天天爽视频 | 一区二区国产在线观看 | 午夜爽爽爽男女免费观看hd | 九久久 | 欧美一级网站 | 在线免费视频国产 | 日本一级在线播放线观看免 | 欧美日韩99 | 久久久久久亚洲精品中文字幕 | 69成人做爰视频在线观看 | 欧美成人午夜片一一在线观看 | 午夜伦y4480影院中文字幕 | 久久综合精品国产一区二区三区 | 成年网在线观看免费观看网址 | 夜色www国产精品资源站 | 国产精品一区在线免费观看 | 成人国产视频在线观看 | 欧美大片毛片aaa免费看 | 国产免费一区不卡在线 |