From 3e2b0a3e896b8792b6d55c615619a00f61d19322 Mon Sep 17 00:00:00 2001 From: saxon-y <49136621+saxon-y@users.noreply.github.com> Date: Wed, 19 Apr 2023 12:22:01 +0800 Subject: [PATCH] fix: press enter to reload when the Pagination is focused (#1720) --- .../src/schema-component/antd/pagination/index.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/pagination/index.tsx b/packages/core/client/src/schema-component/antd/pagination/index.tsx index 674dedb262..6344e9a70a 100644 --- a/packages/core/client/src/schema-component/antd/pagination/index.tsx +++ b/packages/core/client/src/schema-component/antd/pagination/index.tsx @@ -1,6 +1,6 @@ import { observer } from '@formily/react'; import { Pagination as AntdPagination } from 'antd'; -import React from 'react'; +import React, { KeyboardEventHandler } from 'react'; import { useProps } from '../../hooks/useProps'; export const Pagination = observer((props: any) => { @@ -8,5 +8,15 @@ export const Pagination = observer((props: any) => { if (hidden) { return null; } - return ; + const onKeypress: KeyboardEventHandler = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + } + }; + + return ( +
+ ; +
+ ); });