在/admin 下挂载 react-admin [英] Mount react-admin under /admin

查看:49
本文介绍了在/admin 下挂载 react-admin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是希望我所有的管理页面都在 /admin 下.

I simply want all of my admin pages to be under /admin.

<Admin
  title="Admin"
  dashboard={Dashboard}
  dataProvider={restClient}
  history={history}
>
  <Resource
    name="users"
    list={UserList}
  />
</Admin>

我的主页位于 /admin 但当我单击侧栏中的用户时,它会将路径更改为 /users 而不是 /admin/users.

My main page is at /admin but when I click Users in the sidebar, it changes the path to /users and not /admin/users.

我使用的是 react-admin 2.0.0.

I'm using react-admin 2.0.0.

推荐答案

key 实际上在传递给 Admin 组件的 history prop 中:

The key is actually in the history prop passed to the Admin component:

import createHistory from 'history/createBrowserHistory';

const history = createHistory({ basename: '/admin' });

<Admin history={history} />

这篇关于在/admin 下挂载 react-admin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆