Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporateCulture-qd
Overview
Overview
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
王立鹏
corporateCulture-qd
Commits
fec5c75e
Commit
fec5c75e
authored
Feb 13, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 20331】 perf: 优化查询hook,增加成功回调,可用于对响应数据处理
parent
96bad3c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
usePageSearch.ts
src/hooks/usePageSearch.ts
+4
-0
No files found.
src/hooks/usePageSearch.ts
View file @
fec5c75e
...
...
@@ -33,6 +33,8 @@ export interface PageSearchConfig<T extends PageSearchParams = PageSearchParams>
pageSizeField
?:
keyof
T
/** 格式化列表数据 */
formatList
?:
(
list
:
any
[])
=>
any
[]
/** 成功回调 */
success
?:
(
list
:
Ref
<
any
[]
>
)
=>
void
}
/**
...
...
@@ -57,6 +59,7 @@ export function usePageSearch<
pageField
=
'current'
as
keyof
TParams
,
pageSizeField
=
'size'
as
keyof
TParams
,
formatList
=
(
list
:
any
[])
=>
list
,
success
=
()
=>
{},
}
=
config
const
loading
=
shallowRef
(
false
)
...
...
@@ -79,6 +82,7 @@ export function usePageSearch<
list
.
value
=
formatList
(
data
.
list
||
[])
total
.
value
=
data
.
total
||
0
success
?.(
list
)
}
catch
(
error
)
{
console
.
log
(
'分页搜索失败:'
,
error
)
list
.
value
=
[]
...
...
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