展览元素包含 9 个展览的表格。单击表格中的展览后,我想路由到展览页面(Exhibit1),目前正在尝试通过嵌套路由执行此操作。
在展览中我有<Link to='/exhibitions/exhibit1'> Exhibit1 </Link> ... <Outlet/>
单击链接时,Exhibit1 组件将呈现在表格下方。
如何隐藏父元素(Exhibitions)并路由到 Exhibit1 页面?
感谢所有指向解决方法的指针。
<Routes>
<Route path='/' element={<Home/>}/>
<Route path='/home' element={<Home/>}/>
<Route path='/aboutUs' element={<AboutUs/>}/>
<Route path='/exhibitions' element={<Exhibitions/>}>
<Route path='exhibit1' element={<Exhibit1/>}/>
</Route>
<Route path='/photographers' element={<Photographers/>}/>
<Route path='/contact' element={<Contact/>}></Route>
<Route path='*' element={<Error/>}> </Route>
</Routes>
Run Code Online (Sandbox Code Playgroud)