- 重构 usePagination 钩子,使用 ref 替代直接操作对象属性 - 优化多个组件中的分页相关代码,使用新的 pagination 结构 - 在 bulletin-card 组件中添加空状态卡片样式 - 调整 message-edit 组件,增加消息类型选择功能 - 修改 bulletins 接口,统一字段命名
27 lines
569 B
TypeScript
27 lines
569 B
TypeScript
import { ref } from 'vue';
|
|
|
|
export default function usePagination(initValue = false) {
|
|
interface Pagination {
|
|
page: number;
|
|
size: number;
|
|
current: number;
|
|
total: number;
|
|
}
|
|
|
|
const pagination = ref<Pagination>({
|
|
page: 1,
|
|
size: 10,
|
|
current: 1,
|
|
total: 0,
|
|
});
|
|
const setPagination = (value: Pagination) => {
|
|
pagination.value.page = value.page;
|
|
pagination.value.size = value.size;
|
|
pagination.value.current = value.current;
|
|
pagination.value.total = value.total;
|
|
};
|
|
return {
|
|
pagination,
|
|
setPagination,
|
|
};
|
|
} |