File tree 1 file changed +16
-14
lines changed
1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -63,20 +63,22 @@ export default function usePagination(
63
63
} ) ) ;
64
64
65
65
// ============ Basic Pagination Config ============
66
- const mergedPagination = computed ( ( ) =>
67
- extendsObject < Partial < TablePaginationConfig > > ( innerPagination . value , pagination . value , {
68
- total : paginationTotal . value > 0 ? paginationTotal . value : totalRef . value ,
69
- } ) ,
70
- ) ;
71
-
72
- // Reset `current` if data length or pageSize changed
73
- const maxPage = Math . ceil (
74
- ( paginationTotal . value || totalRef . value ) / mergedPagination . value . pageSize ! ,
75
- ) ;
76
- if ( mergedPagination . value . current ! > maxPage ) {
77
- // Prevent a maximum page count of 0
78
- mergedPagination . value . current = maxPage || 1 ;
79
- }
66
+ const mergedPagination = computed ( ( ) => {
67
+ const mP = extendsObject < Partial < TablePaginationConfig > > (
68
+ innerPagination . value ,
69
+ pagination . value ,
70
+ {
71
+ total : paginationTotal . value > 0 ? paginationTotal . value : totalRef . value ,
72
+ } ,
73
+ ) ;
74
+ // Reset `current` if data length or pageSize changed
75
+ const maxPage = Math . ceil ( ( paginationTotal . value || totalRef . value ) / mP . pageSize ! ) ;
76
+ if ( mP . current ! > maxPage ) {
77
+ // Prevent a maximum page count of 0
78
+ mP . current = maxPage || 1 ;
79
+ }
80
+ return mP ;
81
+ } ) ;
80
82
81
83
const refreshPagination = ( current = 1 , pageSize ?: number ) => {
82
84
if ( pagination . value === false ) return ;
You can’t perform that action at this time.
0 commit comments