获取参数
<!DOCTYPE HTML>
<html>
<head>
<title>js获取url后面的参数</title>
<meta charset="utf-8" />
<script>
function GetRequest() {
var url = '/pages/dynamic?current=1&id=222&name=小红'; //获取url中"?"符后的字串
var theRequest = new Object();
let symbolIdx = url.indexOf("?");
if (symbolIdx != -1) {
var str = url.substr(symbolIdx + 1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
console.log("Request", GetRequest())
</script>
</head>
<body>
</body>
</html>
实现思路
跳转保存
tabbar页面接收
离开当前页面移除