Skip to content

Commit

Permalink
fix(Select): clearable and group style (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Oct 27, 2022
1 parent ee550a5 commit cce18e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions src/select/optionGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
computed, defineComponent, ref, toRefs, inject,
computed, defineComponent, toRefs, inject,
} from '@vue/composition-api';
import Vue from 'vue';
import { ScopedSlotReturnValue } from 'vue/types/vnode';
Expand All @@ -21,7 +21,6 @@ export default defineComponent({
props: { ...props },
setup(props: TdOptionGroupProps) {
const { divider } = toRefs(props);
const ulRef = ref<HTMLElement>(null);
const tSelect: any = inject('tSelect');
const { sizeClassNames } = useCommonClassName();
const COMPONENT_NAME = usePrefixClass('select');
Expand All @@ -36,7 +35,6 @@ export default defineComponent({
]);
return {
classes,
ulRef,
classPrefix,
componentName: COMPONENT_NAME,
};
Expand All @@ -47,9 +45,7 @@ export default defineComponent({
return (
<li class={this.classes}>
<div class={`${this.componentName}-option-group__header`}>{this.label}</div>
<ul class={`${this.classPrefix}-select__list`} ref="ulRef">
{children}
</ul>
{children}
</li>
);
},
Expand Down
4 changes: 2 additions & 2 deletions src/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ export default defineComponent({
}
const getOriginOptions = (val: SelectValue) => {
const option = optionsMap.value.get(val);
delete (option as any).index;
if (option) delete (option as any).index;
return option;
};
const getFormatOption = (val: SelectValue) => {
const option = optionsMap.value.get(val) || oldValueMap.get(val);
delete (option as any).index;
if (option) delete (option as any).index;
return {
[valueOfKeys]: get(option, valueOfKeys),
[labelOfKeys]: get(option, labelOfKeys),
Expand Down

0 comments on commit cce18e9

Please sign in to comment.