最近用到的,文字輸入框是一個組件,在后台管理系統中保存,關鍵代碼如下:
<el-form-item v-if="modelForm.type && modelForm.type == 'ABOUTUS'" label=" " prop="desc" > <span style="text-line:center">企業簡介</span> <Tinymces ref="editor" :action="$axios.getUrl() + '/management/fileupload/image'" v-model="detailText" :height="700" /> </el-form-item> ...................................... data() { return { types: [], detailText: "", .................... }
} methods: { .................... initData() { var that = this; if (this.id != "") { this.activityId = this.id; this.isSave = false; this.$axios .get( "/management/basedata/menuBanners/" + this.activityId + "/update" ) .then(res => { this.modelForm = res.content.menuBanner; if (this.modelForm.video) { this.fileList = [ { name: this.modelForm.video.substring( this.modelForm.video.lastIndexOf("/") + 1 ), url: this.modelForm.video } ]; } this.detailText = decodeURIComponent(this.modelForm.detail); this.types = res.content.types; }) .catch(res => {}); } else { ............................................
網站部分代碼:
<div class="weui-col-50 item gren animated bounceInLeft"> <div v-html="form.detail"></div> </div>
getImg() { this.$http .get('/getBannerInfo?type=ABOUTUS') .then(res => { console.log(res) this.form = res.body.content this.form.detail = encodeURI(this.modelForm.detail) ......................... console.log(this.form) }) .catch(res => {}) },
解碼一個編碼的 URI 組件
decodeURIComponent()
把字符串編碼為 URI
encodeURI()
......................今天也是想他的一天