diff --git a/docs/examples/jumper.jsx b/docs/examples/jumper.jsx index e5867964..182c195b 100644 --- a/docs/examples/jumper.jsx +++ b/docs/examples/jumper.jsx @@ -17,6 +17,7 @@ function onChange(current, pageSize) { const App = () => ( <> +

默认

( onChange={onChange} total={450} /> -
+

禁用

( total={450} disabled /> +

单页默认隐藏

+ +
+ ); diff --git a/src/Pagination.jsx b/src/Pagination.jsx index c2e6bb79..c6a6fd4f 100644 --- a/src/Pagination.jsx +++ b/src/Pagination.jsx @@ -185,7 +185,8 @@ class Pagination extends React.Component { }; shouldDisplayQuickJumper = () => { - const { showQuickJumper, pageSize, total } = this.props; + const { showQuickJumper, total } = this.props; + const { pageSize } = this.state; if (total <= pageSize) { return false; } diff --git a/tests/jumper.test.js b/tests/jumper.test.js index d5c905a1..85529067 100644 --- a/tests/jumper.test.js +++ b/tests/jumper.test.js @@ -192,4 +192,28 @@ describe('simple quick jumper', () => { wrapper.find('.rc-pagination-options-quick-jumper-button').exists(), ).toBe(false); }); + + it('Quick Jumper should hide when only one page', () => { + wrapper = mount( + , + ); + expect(wrapper.find('.rc-pagination-options-quick-jumper').exists()).toBe( + false, + ); + }); + + // https://github.com/ant-design/ant-design/issues/32991 + it('Quick Jumper should hide when only one page when has pageSize', () => { + wrapper = mount( + , + ); + expect(wrapper.find('.rc-pagination-options-quick-jumper').exists()).toBe( + false, + ); + }); }); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 0976a47b..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "esnext", - "module": "commonjs", - "lib": ["dom", "es2017"], - "jsx": "react", - "strict": true, - "baseUrl": "./", - "esModuleInterop": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "skipLibCheck": true, - "declaration": true, - "paths": { - "@/*": ["src/*"], - "@@/*": ["src/.umi/*"], - "rc-pagination": ["src/index.js"] - } - } -}