我有一个应用程序索引页,其中列出了我的所有应用程序。索引页也是默认路由。我想在索引页面中嵌套一个“应用程序新”模式。这样我就可以在索引页面顶部呈现模式。但是,我无法成功嵌套在默认路由中。
我认为它应该是这样工作的
<Route name='applications' path='/applications' handler={Applications}>
<DefaultRoute name="index" handler={ApplicationIndex}>
<Route name='applicationNew' path='/new' handler={ApplicationNewModal}/>
</DefaultRoute>
<Route name="applicationShow" path=':key' handler={ApplicationShow}/>
</Route>
当我尝试转换到“applicationNew”时,我收到一条错误消息,指出未找到具有该名称的路由
最佳答案
您需要将其移动到具有 handler={ApplicationIndex}
的路由内的自己的路由。
<Route name='applications' path='/applications' handler={Applications}>
<DefaultRoute name="index" handler={ApplicationIndex} />
<Route handler={ApplicationIndex}>
<Route name='applicationNew' path='/new' handler={ApplicationNewModal} />
</Route>
<Route name="applicationShow" path=':key' handler={ApplicationShow}/>
</Route>
关于javascript - 嵌套在默认路由中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30900338/