提示:
最下面是获取参数,携带多个参数时,直接声明变量,赋值获取就行。
vue.js版本的html也同样支持
function getData() {
var url = location.search;
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
}
}
//第一个cid是你要得到的值随便取的名字
//theRequest.cid cid是路径后面的参数名
var cid = theRequest.cid;
// 第二个参数 正常获取就行
var name = theRequest.name;
}