mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-31 18:10:50 +01:00
29 lines
546 B
TypeScript
29 lines
546 B
TypeScript
import {SetupContext} from 'vue';
|
|
|
|
const usePagination = (props: TableProps, ctx: SetupContext) => {
|
|
const {emit} = ctx;
|
|
|
|
const onCurrentChange = (page: number) => {
|
|
const {pageSize} = props;
|
|
emit('pagination-change', {
|
|
page,
|
|
size: pageSize,
|
|
} as TablePagination);
|
|
};
|
|
|
|
const onSizeChange = (size: number) => {
|
|
const {page} = props;
|
|
emit('pagination-change', {
|
|
page,
|
|
size,
|
|
} as TablePagination);
|
|
};
|
|
|
|
return {
|
|
onCurrentChange,
|
|
onSizeChange,
|
|
};
|
|
};
|
|
|
|
export default usePagination;
|