onClick={() =>history.push('/index/list_info?id=88')}
const urlArr = location.search; //获取url中"?"符后的字串 ?
let id;
let str;
let strS;
if(urlArr.indexOf("?") != -1) {
str = urlArr.substring(1);
strS = str.split("=");
id= strS[1]; //获取id值
}
React 中获取url中的参数值
最新推荐文章于 2023-12-13 15:45:01 发布