亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在react中如何使用decodeURL()函數?。?/h1>

在react中如何使用decodeURL()函數?。?/h1>
慕碼人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 關注
  • 4592 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號