mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-29 22:56:41 +08:00
feat(projects): add table total items
This commit is contained in:
parent
e57bf0b076
commit
b27cb3f36e
@ -13,6 +13,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
|
|||||||
const scope = effectScope();
|
const scope = effectScope();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
const isMobile = computed(() => appStore.isMobile);
|
||||||
|
|
||||||
const { apiFn, apiParams, immediate } = config;
|
const { apiFn, apiParams, immediate } = config;
|
||||||
|
|
||||||
const SELECTION_KEY = '__selection__';
|
const SELECTION_KEY = '__selection__';
|
||||||
@ -104,6 +106,7 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
showSizePicker: true,
|
showSizePicker: true,
|
||||||
pageSizes: [10, 15, 20, 25, 30],
|
pageSizes: [10, 15, 20, 25, 30],
|
||||||
|
prefix: page => $t('datatable.itemCount', { total: page.itemCount }),
|
||||||
onUpdatePage: async (page: number) => {
|
onUpdatePage: async (page: number) => {
|
||||||
pagination.page = page;
|
pagination.page = page;
|
||||||
|
|
||||||
@ -131,7 +134,8 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
|
|||||||
const mobilePagination = computed(() => {
|
const mobilePagination = computed(() => {
|
||||||
const p: PaginationProps = {
|
const p: PaginationProps = {
|
||||||
...pagination,
|
...pagination,
|
||||||
pageSlot: appStore.isMobile ? 3 : 9
|
pageSlot: isMobile ? 3 : 9,
|
||||||
|
prefix: isMobile ? undefined : pagination.prefix
|
||||||
};
|
};
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
@ -445,6 +445,9 @@ const local: App.I18n.Schema = {
|
|||||||
expand: 'Expand Menu',
|
expand: 'Expand Menu',
|
||||||
pin: 'Pin',
|
pin: 'Pin',
|
||||||
unpin: 'Unpin'
|
unpin: 'Unpin'
|
||||||
|
},
|
||||||
|
datatable: {
|
||||||
|
itemCount: 'Total {total} items'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -445,6 +445,9 @@ const local: App.I18n.Schema = {
|
|||||||
expand: '展开菜单',
|
expand: '展开菜单',
|
||||||
pin: '固定',
|
pin: '固定',
|
||||||
unpin: '取消固定'
|
unpin: '取消固定'
|
||||||
|
},
|
||||||
|
datatable: {
|
||||||
|
itemCount: '共 {total} 条'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
3
src/typings/app.d.ts
vendored
3
src/typings/app.d.ts
vendored
@ -602,6 +602,9 @@ declare namespace App {
|
|||||||
pin: string;
|
pin: string;
|
||||||
unpin: string;
|
unpin: string;
|
||||||
};
|
};
|
||||||
|
datatable: {
|
||||||
|
itemCount: string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
type GetI18nKey<T extends Record<string, unknown>, K extends keyof T = keyof T> = K extends string
|
type GetI18nKey<T extends Record<string, unknown>, K extends keyof T = keyof T> = K extends string
|
||||||
|
Loading…
Reference in New Issue
Block a user