为了账号安全,请及时绑定邮箱和手机立即绑定

在react中如何使用decodeURL()函数啊?

在react中如何使用decodeURL()函数啊?

慕码人1183263 2016-12-23 13:07:09
我想问一下,怎么在react中使用decodeURL()函数?我在react中写了这么一个函数来接受url传递过来的参数,然后想把它解码为汉字,但我使用了decodeURL()之后说function GetRequest() {       var url = decodeURL(window.location.search); //获取url中"?"符后的字串       var theRequest = new Object();       if (url.indexOf("?") != -1) {          var str = url.substr(1);          var strs = str.split("&");          for(var i = 0; i < strs.length; i ++) {             theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);          }       }       console.log(theRequest.name)       return theRequest;     }    const Request = GetRequest();结果是这样的:
查看完整描述

1 回答

已采纳
?
Caballarii

TA贡献1123条经验 获得超629个赞

window.decodeURL

查看完整回答
反对 回复 2016-12-23
  • 1 回答
  • 0 关注
  • 4391 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信