美文网首页
2019-02-11 encodeURI

2019-02-11 encodeURI

作者: qiaoguoxing | 来源:发表于2019-02-11 14:56 被阅读0次

    地址栏传参过程中,遇到中文要编码、解码

    编码

    let openUrl = '?id=' + id + '&month=' + month + '&rc=' + rc + '&pc=' + pc + '&nf=' + nf + '&cbts=' + encodeURI(encodeURI(cbts)) + '&MonRrSea=' + MonRrSea + '&cbtsMc=' + encodeURI(encodeURI(cbtsMc)) + '&cbtsORcbr=' + this.cbtsORcbr + '&cbrMc=' + encodeURI(encodeURI(cbrMc)) + '&cbr=' + cbr + '&cbtstype=' + type + '&cbtstype=' + cbtstype

    解码

    this.lastParams.cbts = decodeURI(this.lastParams.cbts)

    this.lastParams.cbtsMc = decodeURI(decodeURI(this.lastParams.cbtsMc))

    this.lastParams.cbrMc = decodeURI(decodeURI(this.lastParams.cbrMc))

    编码几次就要解码几次

    相关文章

      网友评论

          本文标题:2019-02-11 encodeURI

          本文链接:https://www.haomeiwen.com/subject/pkeqeqtx.html