ant-design/components/pagination/demo/controlled.md
2022-05-23 14:37:16 +08:00

545 B

order title
8
zh-CN en-US
受控 Controlled

zh-CN

受控制的页码。

en-US

Controlled page number.

import type { PaginationProps } from 'antd';
import { Pagination } from 'antd';
import React, { useState } from 'react';

const App: React.FC = () => {
  const [current, setCurrent] = useState(3);

  const onChange: PaginationProps['onChange'] = page => {
    console.log(page);
    setCurrent(page);
  };

  return <Pagination current={current} onChange={onChange} total={50} />;
};

export default App;