久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

vue中如何使用ueditor富文本編輯器

這篇文章主要介紹vue中如何使用ueditor富文本編輯器,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)建站專注于企業(yè)營銷型網(wǎng)站建設(shè)、網(wǎng)站重做改版、船營網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5建站、商城開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為船營等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

Vue的優(yōu)點(diǎn)

Vue具體輕量級框架、簡單易學(xué)、雙向數(shù)據(jù)綁定、組件化、數(shù)據(jù)和結(jié)構(gòu)的分離、虛擬DOM、運(yùn)行速度快等優(yōu)勢,Vue中頁面使用的是局部刷新,不用每次跳轉(zhuǎn)頁面都要請求所有數(shù)據(jù)和dom,可以大大提升訪問速度和用戶體驗(yàn)。

最近在做后臺管理系統(tǒng)的時(shí)候遇到要使用富文本編輯器。最后選擇了ueditor,我的項(xiàng)目使用 vue+vuex+vue-router+webpack+elementUI的方案完成框架的搭建,

 1、下載UEditor官網(wǎng)最新的jsp版本的包,下載完成解壓之后得到一個(gè)utf8-jsp的文件夾,里面包含的內(nèi)容如下:

vue中如何使用ueditor富文本編輯器vue中如何使用ueditor富文本編輯器

2、將這個(gè)文件夾改名為ueditor,并且移入自己項(xiàng)目中的static文件夾下,修改ueditor.config.js文件夾中的內(nèi)容,如下圖:

vue中如何使用ueditor富文本編輯器vue中如何使用ueditor富文本編輯器

3、編寫子組件

<template>
 <div :id="id" type="text/plain"></div>
</template>
<script>
 import '../../../static/ueditor/ueditor.config.js'
 import '../../../static/ueditor/ueditor.all.min.js'
 import '../../../static/ueditor/lang/zh-cn/zh-cn.js'
 import '../../../static/ueditor/ueditor.parse.min.js'
 export default {
 name: 'UE',
 data() {
 return {
 editor: null
 }
 },
 props: {
 defaultMsg: {
 type: String,
 default: '請輸入內(nèi)容'
 },
 config: {
 type: Object
 },
 id: {
 type: String,
 default: `ue${Math.random(0, 100)}`
 }
 },
 mounted() {
 this.$nextTick(() => {
 this.editor = UE.getEditor(this.id, this.config); // 初始化UE
 this.editor.addListener("ready", () => {
  this.editor.execCommand('insertHtml', this.defaultMsg);
  this.editor.focus() // 確保UE加載完成后,放入內(nèi)容。
 })
 })
 },
 methods: {
 getUEContent() { // 獲取內(nèi)容方法
 return this.editor.getContent()
 },
 clearContent() { // 清空編輯器內(nèi)容
 return this.editor.execCommand('cleardoc');
 },
 },
 beforeDestroy() {
 // 組件銷毀的時(shí)候,要銷毀 UEditor 實(shí)例
 if (this.editor !== null && this.editor.destroy) {
 this.editor.destroy();
 }
 }
 }
</script>
<style scoped></style>

4、在父組件中使用

<UE :config="configEditor" :id="ue1" ref="ue" :defaultMsg="val"></UE>

5、弄好之后,上傳圖片會提示后端配置項(xiàng)http錯(cuò)誤,文件上傳會提示上傳錯(cuò)誤。這里提別申明一點(diǎn),ueditor在前端配置好后,需要與后端部分配合進(jìn)行,然后將配置ueditor.config.js 里的serverUrl的前綴改陳你自己的后端訪問的請求路徑地址

serverUrl: "統(tǒng)一請求地址"

以上是“vue中如何使用ueditor富文本編輯器”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

文章題目:vue中如何使用ueditor富文本編輯器
當(dāng)前鏈接:http://sd-ha.com/article0/gpssoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、網(wǎng)頁設(shè)計(jì)公司、全網(wǎng)營銷推廣、網(wǎng)站內(nèi)鏈、網(wǎng)站策劃、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司