uni-app编译成H5通过链接传参

var url = window.location.search; //获取链接
console.log(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)

猜你喜欢

转载自blog.csdn.net/qq_40476712/article/details/106799965