码迷,mamicode.com
首页 > Web开发 > 详细

js解码转码

时间:2018-05-08 19:16:15      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:component   span   技术分享   min   token   com   res   img   技术   

1.

var data = ‘Einvoice_cur_day:"30"‘
var encode = encodeURIComponent(data)//转码
console.log(encode)// Einvoice_cur_day%3A%2230%22
var decode = decodeURIComponent(encode)//解码
console.log(decode)// Einvoice_cur_day:"30"

2.技术分享图片

客户端这种编码格式传给你

js解码

var d = ‘%7b%22TaxNo%22%3a%22910001200150542A%22%2c%22DiskNo%22%3a%22400444151032%22%2c%22Vesion%22%3a%221.0.0.1%22%2c%22Token%22%3a%22b6357f4c-e2e2-4f47-8a26-5e40b6283a51%22%2c%22Cinvoice_cur_day%22%3a%2210%22%2c%22Sinvoice_cur_day%22%3a%2220%22%2c%22Einvoice_cur_day%22%3a%2230%22%2c%22Minvoice_cur_day%22%3a%2225%22%2c%22Cinvoice_cur_month_rest%22%3a%22100%22%2c%22Sinvoice_cur_month_rest%22%3a%22150%22%2c%22Einvoice_cur_month_rest%22%3a%22500%22%2c%22Minvoice_cur_month_rest%22%3a%2210%22%7d‘
var decode = decodeURIComponent(d)
console.log(decode)//{"TaxNo":"910001200150542A","DiskNo":"400444151032","Vesion":"1.0.0.1","Token":"b6357f4c-e2e2-4f47-8a26-5e40b6283a51","Cinvoice_cur_day":"10","Sinvoice_cur_day":"20","Einvoice_cur_day":"30","Minvoice_cur_day":"25","Cinvoice_cur_month_rest":"100","Sinvoice_cur_month_rest":"150","Einvoice_cur_month_rest":"500","Minvoice_cur_month_rest":"10"}

 

js解码转码

标签:component   span   技术分享   min   token   com   res   img   技术   

原文地址:https://www.cnblogs.com/SunShineM/p/9009507.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!