如何隐藏 React-Admin
2.2.0
框架中的操作按钮?
例如,我想仅隐藏导出按钮,或仅显示刷新和导出按钮。
好吧,我自己找到了解决方案。
当您想隐藏所有按钮时:
import { List, CardActions } from 'react-admin';
const NoneActions = props => (
<CardActions />
);
export const AdminList = (props) => (
<List title="Admin List" {...props} actions={<NoneActions />}>
...
</List>
);
当您只想显示重新加载按钮时:
import { List, CardActions, RefreshButton } from 'react-admin';
const ActionsRefresh = props => (
<CardActions>
<RefreshButton />
</CardActions>
);
export const AdminList = (props) => (
<List title="Admin List" {...props} actions={<ActionsRefresh />}>
...
</List>
);
<List actions={null} {...props}>