zoukankan      html  css  js  c++  java
  • Vue文字转编码与解码

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

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

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

  • 相关阅读:
    JVM调优总结(五)-分代垃圾回收详述1
    JVM调优总结(四)-垃圾回收面临的问题
    JVM调优总结(三)-基本垃圾回收算法
    JVM调优总结(二)-一些概念
    JVM调优总结(一)-- 一些概念
    ASP过滤HTML标签
    ASP防止盗链的一段代码
    通用安全字符串输入,彻底替换server.htmlencode
    ASP长文章分页的两个方法,函数
    自己用到的一个字符串替换函数
  • 原文地址:https://www.cnblogs.com/vivin-echo/p/14060007.html
Copyright © 2011-2022 走看看