React Admin - 如何隐藏操作按钮

问题描述 投票:0回答:2

如何隐藏 React-Admin

2.2.0
框架中的操作按钮?

例如,我想仅隐藏导出按钮,或仅显示刷新和导出按钮。

reactjs react-admin
2个回答
21
投票

好吧,我自己找到了解决方案。

当您想隐藏所有按钮时:

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>
);

0
投票
<List actions={null} {...props}>
© www.soinside.com 2019 - 2024. All rights reserved.