Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
d20c3a2e
Commit
d20c3a2e
authored
May 10, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增 beforePaginationChange 属性
parent
c2e9d6f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
NormalTable.tsx
src/components/PolymericTable/NormalTable.tsx
+6
-1
interface.ts
src/components/PolymericTable/interface.ts
+4
-0
No files found.
src/components/PolymericTable/NormalTable.tsx
View file @
d20c3a2e
...
...
@@ -35,6 +35,7 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm
onPaginationChange
,
full
,
renderFootContent
,
beforePaginationChange
,
...
restProps
}
=
props
;
...
...
@@ -99,7 +100,11 @@ const NormalTable: React.ForwardRefRenderFunction<NormalTableRefHandleType, Norm
}
},
[
props
.
dataSource
]);
const
handlePaginationChange
=
(
page
:
number
,
size
:
number
)
=>
{
const
handlePaginationChange
=
async
(
page
:
number
,
size
:
number
)
=>
{
if
(
beforePaginationChange
)
{
const
flag
=
await
beforePaginationChange
?.(
page
,
size
);
if
(
!
flag
)
return
;
}
// 内部自己维护 page、size
if
(
!
(
'current'
in
pagination
))
{
setCurrent
(
page
);
...
...
src/components/PolymericTable/interface.ts
View file @
d20c3a2e
...
...
@@ -87,6 +87,10 @@ export interface NormalTableProps<T> extends Omit<TableProps<T>, 'pagination'> {
* 渲染底部内容
*/
renderFootContent
?:
()
=>
React
.
ReactNode
,
/**
* 分页器改变触发的钩子,若返回 false 则停止触发请求
*/
beforePaginationChange
?:
(
nextPage
:
number
,
nextSize
:
number
)
=>
boolean
|
Promise
<
boolean
>
,
}
export
interface
EditableCellProps
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment