css - 想在材料反应表中增加上一页和下一页分页图标大小
问题描述
我想在材料表反应代码中增加<
上一页和>
下一页图标大小如下:
localization =
{ { body : {}
, toolbar: { searchTooltip: 'Search'}
, pagination:
{ labelRowsSelect : 'rows'
, labelDisplayedRows: ' {from}-{to} of {count}'
, firstTooltip : 'First Page'
, previousTooltip : 'Previous Page'
, nextTooltip : 'Next Page'
, previousLabel : '<'
, nextLabel : '>'
, size : "lg"
, lastTooltip : 'Last Page'
} } }
解决方案
您的问题已在此处得到解答。
Material-UI TablePagination组件允许您传递一个 ActionsComponent 道具(如果您自己不传递,它们会提供自己的默认 TablePaginationActions 组件)。
在您的自定义 ActionsComponent 中,您可以使用iconStyle
prop 定义 IconButton 组件样式。
这是来自Material-UI 文档的自定义 ActionsComponent 的示例:
function TablePaginationActions(props) {
const handleFirstPageButtonClick = event => {
onChangePage(event, 0);
};
const handleBackButtonClick = event => {
onChangePage(event, page - 1);
};
const handleNextButtonClick = event => {
onChangePage(event, page + 1);
};
const handleLastPageButtonClick = event => {
onChangePage(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
};
return (
<div className={classes.root}>
<IconButton
onClick={handleFirstPageButtonClick}
disabled={page === 0}
aria-label="first page"
>
{theme.direction === 'rtl' ? <LastPageIcon /> : <FirstPageIcon />}
</IconButton>
<IconButton onClick={handleBackButtonClick} disabled={page === 0} aria-label="previous page">
{theme.direction === 'rtl' ? <KeyboardArrowRight /> : <KeyboardArrowLeft />}
</IconButton>
<IconButton
onClick={handleNextButtonClick}
disabled={page >= Math.ceil(count / rowsPerPage) - 1}
aria-label="next page"
>
{theme.direction === 'rtl' ? <KeyboardArrowLeft /> : <KeyboardArrowRight />}
</IconButton>
<IconButton
onClick={handleLastPageButtonClick}
disabled={page >= Math.ceil(count / rowsPerPage) - 1}
aria-label="last page"
>
{theme.direction === 'rtl' ? <FirstPageIcon /> : <LastPageIcon />}
</IconButton>
</div>
);
}
推荐阅读
- python - 是否可以只遍历列表列表中的某个索引?
- docker - “管道”核心模式不会在 docker 容器内创建核心转储
- python - Pyspark:如何从 pyspark.sql.dataframe.DataFrame 中选择唯一 ID 数据?
- ios - 如何在 iOS 中使用委托模拟外部框架类?
- reactjs - 索引签名是我的 React props TypeScript 接口问题的正确解决方案吗?
- mysql - Mysql从计算的间隔中选择日期
- arduino - ADE7953板上的SPI
- react-native - bootstrap/dist/css/bootstrap.min.css 找不到
- html - 我有一个基本上是垂直的 html 表单,但我真的不知道如何在同一行上创建两个文本字段
- reactjs - React 测试库中的“HTMLElement”类型上不存在属性“值”