【发布时间】:2021-03-18 13:57:45
【问题描述】:
我的 React 应用中有常见的详细信息视图。 现在我的详细视图 URL 是这样的
blog-details/:blogId
但我想像这样更改网址
host.com/{blog-title}/{blog-type}/{blog-id}
我该怎么做? 我正在使用 react-router,我想使用单个详细信息来查看具有不同动态 URL slug 的组件。
【问题讨论】:
-
提供更新的
path="/:blogTitle/:blogType/:blogId"道具,像这样?请包含您尝试的Minimal, Complete, and Reproducible 代码示例。 -
@DrewReese 每次博客标题和其他内容不同时都会起作用?
-
努力改变你的代码来处理你想要的路线/路径?您的问题不清楚。
标签: node.js reactjs react-router react-router-dom