这是基于vue-vben-admin 模板适用于abp vNext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
936 B

import type { ComputedRef } from 'vue';
import type { BasicTableProps, TableRowSelection } from '../types/table';
import { computed, unref } from 'vue';
import {} from '/@/hooks/web/useI18n';
import { useI18n } from 'vue-i18n';
export function useTableAlert(
propsRef: ComputedRef<BasicTableProps>,
rowSelectionRef: ComputedRef<TableRowSelection | null>,
) {
const { t } = useI18n();
const getSelectRowKeysCount = computed(() => {
const rowSelection = unref(rowSelectionRef);
if (!rowSelection?.selectedRowKeys) {
return 0;
}
return rowSelection.selectedRowKeys.length;
});
const getAlertEnabled = computed(() => {
const props = unref(propsRef);
return props.useSelectedAlert === true;
});
const getAlertMessage = computed(() => {
return t('component.table.selectedRows', { count: unref(getSelectRowKeysCount) });
});
return {
getAlertEnabled,
getAlertMessage,
};
}