【发布时间】:2019-08-08 15:35:44
【问题描述】:
我正在尝试创建一个可以捕获所有无效 URL 的路由,然后在没有管理布局的情况下向用户显示我的自定义 404 页面。我的问题是,我的 404 页面总是显示管理布局(即使用户没有登录)。我的 routes.js 中有这些路线:
export default [
<Switch>
<Route exact path="/password-reset" component={ResetPassword} noLayout />,
<Route exact path="*" component={NotFound} noLayout/>
</Switch>
];
我已经在我的 App.js 的 Admin 组件中添加了这个位:
const App = () => (
<Admin
catchAll= {NotFound}
customRoute= {routes}
>
</Admin>
);
知道如何处理 404 页面,以便它可以捕获所有无效 URL 并且不会显示管理布局吗?
提前谢谢你。
【问题讨论】:
标签: reactjs react-router react-router-v4 react-admin