import { VxeUI } from 'vxe-pc-ui';


export const genderFormatter = (params: string | { cellValue: string }, options?: { label: string; value: string }[]) => {
  const cellValue = typeof params === 'string' ? params : params?.cellValue;
  if ( !options?.length ) {
    options = [
      { label: '男', value: '0' },
      { label: '女', value: '1' },
      { label: '未知', value: '2' },
    ];
  }
  return options.find(option => option.value === cellValue)?.label ?? cellValue;
};

VxeUI.formats.add('gender', genderFormatter);
