首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >url栏中的重复父路径

url栏中的重复父路径
EN

Stack Overflow用户
提问于 2016-02-16 21:39:36
回答 1查看 1.6K关注 0票数 4

使用:

代码语言:javascript
复制
"react-router": "^2.0.0",
"react-router-relay": "^0.9.0",

当我将任何链接推到父路径下时,每个新的router.push调用都会在地址栏中复制父路径。

代码语言:javascript
复制
// http://localhost:3000

router.push('auth/profile')
// http://localhost:3000/auth/profile

router.push('auth/profile')
// http://localhost:3000/auth/auth/profile

router.push('auth/browse')
// http://localhost:3000/auth/auth/auth/browse

当我记录location (来自react-router)时,它不会显示副本。也许浏览器正在将父路径推到basename上?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-16 22:22:34

改变

代码语言:javascript
复制
router.push('auth/profile')

代码语言:javascript
复制
router.push('/auth/profile')

修好了这个。

票数 13
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35443526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档