如何使用IP本身中的额外参数更改URL



我有一个我的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"

使用字符串.prototype .split(( 使用数组.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)

最新更新