我有一个可以访问我的应用程序的 URL,在应用过滤器后我应该能够传递带有值的参数并替换为 URL
window.location.search.substring(1)
从此 URL 访问应用程序
http://localhost:3000/dashboard/abcd123#bordered=true&titled=true
应用过滤器后需要将 url 更改为
http://localhost:3000/dashboard/abcd123?company_name=value#bordered&titled
我需要更换
"#bordered&titled" with "?company_name=value#bordered&titled"
最佳答案
使用String.prototype.split() 与 Array.prototype.join()
let str="http://localhost:3000/dashboard/abcd123#bordered=true&titled=true"
let result=str.split("#").join("?company_name=value#").replace(/=true/g,"")
console.log(result)
关于javascript - 如何更改 IP 本身带有额外参数的 url?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56162017/