首页 > 其他 > 详细

Vue文字转编码与解码

时间:2020-11-30 11:58:42      阅读:192      评论:0      收藏:0      [点我收藏+]

最近用到的,文字输入框是一个组件,在后台管理系统中保存,关键代码如下:

     <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()

 

 

 

 

 

 

 

 

......................今天也是想他的一天

 

Vue文字转编码与解码

原文:https://www.cnblogs.com/vivin-echo/p/14060007.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!