diff --git a/src/select/hooks/useSelectOptions.ts b/src/select/hooks/useSelectOptions.ts index 721d08a9a0..a4d9b4cb1c 100644 --- a/src/select/hooks/useSelectOptions.ts +++ b/src/select/hooks/useSelectOptions.ts @@ -33,7 +33,7 @@ export const useSelectOptions = (props: TdSelectProps, keys: Ref, inpu dynamicIndex++; return res; }; - if ((option as SelectOptionGroup).group && (option as SelectOptionGroup).children) { + if ((option as SelectOptionGroup).children) { return { ...option, children: (option as SelectOptionGroup).children.map((child) => getFormatOption(child)), @@ -84,7 +84,7 @@ export const useSelectOptions = (props: TdSelectProps, keys: Ref, inpu const res: TdOptionProps[] = []; const getOptionsList = (options: TdOptionProps[]) => { for (const option of options) { - if ((option as SelectOptionGroup).group) { + if ((option as SelectOptionGroup).children) { getOptionsList((option as SelectOptionGroup).children); } else { res.push(option); @@ -120,7 +120,7 @@ export const useSelectOptions = (props: TdSelectProps, keys: Ref, inpu const res: SelectOption[] = []; options.value.forEach((option) => { - if ((option as SelectOptionGroup).group && (option as SelectOptionGroup).children) { + if ((option as SelectOptionGroup).children) { res.push({ ...option, children: (option as SelectOptionGroup).children.filter(filterMethods), diff --git a/src/select/option-group-props.ts b/src/select/option-group-props.ts index dac9dc9ec0..6b29532176 100644 --- a/src/select/option-group-props.ts +++ b/src/select/option-group-props.ts @@ -13,6 +13,5 @@ export default { /** 分组别名 */ label: { type: String, - default: '', }, }; diff --git a/src/select/optionGroup.tsx b/src/select/optionGroup.tsx index faa382bf1d..78dd0cd052 100644 --- a/src/select/optionGroup.tsx +++ b/src/select/optionGroup.tsx @@ -23,7 +23,7 @@ export default defineComponent({ return () => (
  • -
    {props.label}
    + {(props.label ?? false) &&
    {props.label}
    } {renderTNodeJSX('default')}
  • ); diff --git a/src/select/select-panel.tsx b/src/select/select-panel.tsx index 0bcd81ee8c..7fb9e34418 100644 --- a/src/select/select-panel.tsx +++ b/src/select/select-panel.tsx @@ -64,7 +64,7 @@ export default defineComponent({ return (
      {options.map((item: SelectOptionGroup & TdOptionProps & { slots: Slots } & { $index: number }, index) => { - if (item.group) { + if (item.children) { return ( {renderOptionsContent(item.children)}