Material UI - 自定义数据网格分页

3
1个回答

4

我需要更新分页功能以

    <Pagination
      color="primary"
      showFirstButton
      showLastButton
      page={state.pagination.page + 1}
      count={state.pagination.pageCount}
      // @ts-expect-error
      renderItem={props2 => <PaginationItem {...props2} disableRipple />}
      onChange={(event, value) => apiRef.current.setPage(value-1)}
    />
  )

嗨,我已经寻找这个问题很久了。感谢您回来并回答自己的问题。这对我帮助很大。有任何想法为什么会发生这种情况吗?我的意思是,在将当前状态设置为值-1后,将页面值设置为当前状态的值+1只是设置值本身...那么为什么要先减1再加1呢? - A Rogue Otaku

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接