2022-04-18发表2022-04-18更新Web几秒读完 (大约27个字)访问量 0 次 React获取当前页面路由路径 获取当前页面路由路径: 123const urlParams = new URL(window.location.href);const pathname = urlParams?.pathname;console.log("pathname:", pathname); React获取当前页面路由路径https://www.sgknight.cn/2022/04/18/react-get-current-page-url-path/作者knight发布于2022-04-18更新于2022-04-18许可协议#Web