我正在从v5迁移到v6.在V6 it seems中,您不能再使用regexp.对于这样的路径,有没有快速的解决方法?当然,问题在于仪表板.
<Route path="/doc/:id-:version" />
我正在从v5迁移到v6.在V6 it seems中,您不能再使用regexp.对于这样的路径,有没有快速的解决方法?当然,问题在于仪表板.
<Route path="/doc/:id-:version" />
不能使用部分动态分段,要么全有要么全无.使用单个参数,然后在组件中对其应用字符串拆分逻辑.
示例:
<Route path="/doc/:idVersion" element={....} />
const { idVersion } = useParams();
const [id, version] = idVersion.split("-");
有关详细信息,请参阅Dynamic Segments.