解决方案一:
new URL()
回调地址使用new URL()后重新拼接
const url = "http://192.168.0.121:9000/main.html/?type=aaa#/"
const hrefObj = new URL(url)
let href = hrefObj.origin + hrefObj.pathname + hrefObj.hash + hrefObj.search;

解决方案二
searchParams.get(“参数名”)
const url = "http://192.168.0.121:9000/main.html/?type=aaa#/";
const type = new URL(url).searchParams.get('type');
console.log(type) // aaa
1804

被折叠的 条评论
为什么被折叠?



