| 123456789101112131415161718192021222324252627282930 |
- /**
- * 存储分页信息
- */
- import { reactive } from 'vue';
- import { defineStore } from 'pinia';
- import { DEFAULT_PAGE_SIZE } from '@/constant/pagination';
- export const usePaginationStore = defineStore('pagination', () => {
- const pagination = reactive({
- page: 1,
- pageSize: DEFAULT_PAGE_SIZE,
- });
- const setPage = (page: number) => {
- pagination.page = page;
- };
- const setPageSize = (pageSize: number) => {
- pagination.pageSize = pageSize;
- };
- const resetPagination = () => {
- pagination.page = 1;
- pagination.pageSize = DEFAULT_PAGE_SIZE;
- };
- return {
- pagination,
- setPage,
- setPageSize,
- resetPagination,
- };
- });
|