最近用到的,文字输入框是一个组件,在后台管理系统中保存,关键代码如下:
<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()
......................今天也是想他的一天
原文:https://www.cnblogs.com/vivin-echo/p/14060007.html