feat: 通用的表格复选框是否选中事件

This commit is contained in:
dap 2024-10-18 15:20:20 +08:00
parent 162b3207fd
commit c6984c164c
2 changed files with 22 additions and 3 deletions

View File

@ -1,6 +1,10 @@
import { h } from 'vue'; import { h, type Ref } from 'vue';
import { setupVbenVxeTable, useVbenVxeGrid } from '@vben/plugins/vxe-table'; import {
setupVbenVxeTable,
useVbenVxeGrid,
type VxeGridDefines,
} from '@vben/plugins/vxe-table';
import { Button, Image } from 'ant-design-vue'; import { Button, Image } from 'ant-design-vue';
@ -94,3 +98,18 @@ setupVbenVxeTable({
export { useVbenVxeGrid }; export { useVbenVxeGrid };
export type * from '@vben/plugins/vxe-table'; export type * from '@vben/plugins/vxe-table';
/**
*
*
* @param checked
* @returns function
*/
export function tableCheckboxEvent(checked: Ref<boolean>) {
const event: (params: VxeGridDefines.CheckboxChangeEventParams) => void = (
params,
) => {
checked.value = params.$table.getCheckboxRecords().length > 0;
};
return event;
}

View File

@ -1,4 +1,4 @@
export { setupVbenVxeTable } from './init'; export { setupVbenVxeTable } from './init';
export * from './use-vxe-grid'; export * from './use-vxe-grid';
export { default as VbenVxeGrid } from './use-vxe-grid.vue'; export { default as VbenVxeGrid } from './use-vxe-grid.vue';
export type { VxeGridListeners, VxeGridProps } from 'vxe-table'; export type { VxeGridDefines, VxeGridListeners, VxeGridProps } from 'vxe-table';