【问题标题】:Duplicate parent paths in url barurl 栏中的重复父路径
【发布时间】:2016-05-28 09:06:30
【问题描述】:

使用:

"react-router": "^2.0.0",
"react-router-relay": "^0.9.0",

当我在父路径下推送任何链接时,每次新的router.push 调用,父路径都会在 URL 栏中复制一次。

// 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)时,它不会显示重复项。也许浏览器正在将父路径推送到基本名称上?

【问题讨论】:

    标签: react-router history.js relayjs


    【解决方案1】:

    变化

    router.push('auth/profile')
    

    到

    router.push('/auth/profile')
    

    解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-03
      相关资源
      最近更新 更多