useBatchOperation.ts
550 Bytes
import { computed } from 'vue';
import { TableActionType } from '/@//components/Table';
const useBatchOperation = (
  getRowSelection: TableActionType['getRowSelection'],
  setSelectedRowKeys: TableActionType['setSelectedRowKeys']
) => {
  const isExistOption = computed(() => {
    const rowSelection = getRowSelection();
    return !!rowSelection.selectedRowKeys?.length;
  });
  const resetSelectedOptions = () => {
    setSelectedRowKeys([]);
  };
  return {
    isExistOption,
    resetSelectedOptions,
  };
};
export { useBatchOperation };