Skip to content

Commit 6c88ca6

Browse files
authored
fix: select filter (#1082)
1 parent 63383bc commit 6c88ca6

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

src/checkbox/group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default defineComponent({
125125
const getChildComponentSlots = useChildComponentSlots();
126126

127127
const getOptionListBySlots = () => {
128-
const nodes = getChildComponentSlots('checkbox');
128+
const nodes = getChildComponentSlots('Checkbox');
129129
const arr: Array<CheckboxOptionObj> = [];
130130
nodes?.forEach((node) => {
131131
const option = node.props as CheckboxOptionObj;

src/hooks/slot.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ export function useChildComponentSlots() {
2323
return item;
2424
})
2525
.flat()
26-
.filter((item: VNode) =>
27-
(item.type as Component).name?.toUpperCase().includes(childComponentName.toUpperCase()),
28-
) as VNode[];
26+
.filter((item: VNode) => (item.type as Component).name?.endsWith(childComponentName)) as VNode[];
2927
};
3028
}

src/select/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export const useSelectOptions = (props: TdSelectProps, keys: Ref<SelectKeysType>
3939
});
4040

4141
// 处理 slots
42-
const optionsSlots = getChildComponentSlots('TOption');
43-
const groupSlots = getChildComponentSlots('TOptionGroup');
42+
const optionsSlots = getChildComponentSlots('Option');
43+
const groupSlots = getChildComponentSlots('OptionGroup');
4444

4545
if (isArray(groupSlots)) {
4646
for (const group of groupSlots) {

src/select/select.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export default defineComponent({
281281
value={displayText.value}
282282
disabled={disabled.value}
283283
popupVisible={innerPopupVisible.value}
284-
inputValue={innerInputValue.value}
284+
inputValue={innerPopupVisible.value ? innerInputValue.value : ''}
285285
placeholder={`${placeholderText.value}`}
286286
allowInput={isFilterable.value}
287287
collapsed-items={props.collapsedItems}
@@ -320,6 +320,7 @@ export default defineComponent({
320320
setInnerPopupVisible(val, context);
321321
}}
322322
onInputChange={(value) => {
323+
if (!innerPopupVisible.value) return;
323324
setInputValue(value);
324325
handleSearch(`${value}`);
325326
}}

src/steps/steps.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default defineComponent({
8989
if (props.options?.length) {
9090
options = props.sequence === 'reverse' ? props.options.slice().reverse() : props.options;
9191
} else {
92-
const nodes: VNode[] = getChildComponentByName('TStepItem') as VNode[];
92+
const nodes: VNode[] = getChildComponentByName('StepItem') as VNode[];
9393
options = getOptionListBySlots(nodes);
9494
}
9595
return options;
@@ -98,7 +98,7 @@ export default defineComponent({
9898
const renderContent = () => {
9999
let content = null;
100100
const options = getOptions();
101-
const nodes: VNode[] = getChildComponentByName('TStepItem') as VNode[];
101+
const nodes: VNode[] = getChildComponentByName('StepItem') as VNode[];
102102

103103
content = options.map((item, index) => {
104104
const stepIndex = props.sequence === 'reverse' ? options.length - index - 1 : index;

src/swiper/swiper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default defineComponent({
8787
return {};
8888
});
8989
const swiperItems = () => {
90-
const swiperItemList = getChildComponentByName('TSwiperItem');
90+
const swiperItemList = getChildComponentByName('SwiperItem');
9191
swiperItemLength.value = swiperItemList.length;
9292
const items = swiperItemList.map((swiperItem: any, index) => {
9393
const p = { ...props, ...swiperItem.props };
@@ -241,7 +241,7 @@ export default defineComponent({
241241
</div>
242242
);
243243
}
244-
const swiperItemList = getChildComponentByName('TSwiperItem');
244+
const swiperItemList = getChildComponentByName('SwiperItem');
245245
return (
246246
<ul
247247
class={[

0 commit comments

Comments
 (0)