roymondchen 3c41091f96 refactor(form): 重构 table/group-list 目录结构与新增行逻辑
- 将 table 相关文件迁移至 containers/table 与 containers/table-group-list 目录
- 将新增行处理统一上移至 TableGroupList,通过 add 事件触发
- 抽取 TableGroupListCommonConfig 公共配置类型
- useFullscreen 内聚管理 zIndex
- TableColumnConfig 支持 text 作为 label 别名

Made-with: Cursor
2026-04-24 15:45:15 +08:00

31 lines
722 B
TypeScript

import { computed, type Ref, ref } from 'vue';
import { getDataByPage } from '../../utils/form';
import type { TableProps } from './type';
export const usePagination = (props: TableProps, modelName: Ref<string | number>) => {
const pageSize = ref(10);
/**
* 当前页码
*/
const currentPage = ref(0);
const paginationData = computed(() => getDataByPage(props.model[modelName.value], currentPage.value, pageSize.value));
const handleSizeChange = (val: number) => {
pageSize.value = val;
};
const handleCurrentChange = (val: number) => {
currentPage.value = val - 1;
};
return {
pageSize,
currentPage,
paginationData,
handleSizeChange,
handleCurrentChange,
};
};