跳转到看板路由问题
来源:12-6 优化看板样式

大前端小学徒
2021-09-09
老师好
我的大概是这样的
project/index.tsx
<Routes>
{/*projects/:projectId/kanban*/}
<Route path={"/kanban"} element={<KanbanPage />} />
{/*projects/:projectId/epic*/}
<Route path={"/epic"} element={<EpicPage />} />
<Navigate to={window.location.pathname + "/kanban"} replace={true} />
</Routes>
按钮部分
{
title: '名称',
render(v, project) {
return <Link to={String(project.id)}>{project.name}</Link>
}
},
问题:跳转后多了7/projects路径
从列表跳转到看板路由变化为:
http://localhost:3000/projects
http://localhost:3000/projects/7/projects/7/kanban
我把<Navigate to={window.location.pathname + “/kanban”} replace={true} />换成<Navigate to={"/kanban"} replace={true} />就跟老师的一样了,比较奇怪
浏览器 chrome
react-router@6.0.0-beta.1
写回答
1回答
-
拉丶粑粑
2021-11-28
参考这个答案: https://coding.imooc.com/learn/questiondetail/jlqGxYzEBDZPe1Dk.html
00
相似问题