You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

options.ts 483 B

2 years ago
2 years ago
2 years ago
12345678910111213141516
  1. import { DictValueEnumObj } from '@/components/DictTag';
  2. import { ProSchemaValueEnumObj, ProSchemaValueEnumType } from '@ant-design/pro-components';
  3. export function getValueEnumLabel(
  4. options: DictValueEnumObj | ProSchemaValueEnumObj,
  5. val: string | number | undefined,
  6. defaultValue?: string,
  7. ) {
  8. if (val !== undefined) {
  9. const data = options[val] as ProSchemaValueEnumType;
  10. if (data) {
  11. return data.text;
  12. }
  13. }
  14. return defaultValue ? defaultValue : val;
  15. }