Skip to content

Commit

Permalink
fix(cascader): fix cascader value match error option (#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
berber1016 committed Feb 24, 2022
1 parent b39e178 commit 867f509
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/list/inner/baseItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ const InnerBaseItem = WithRef<HTMLLIElement, BaseItemProps & Omit<DOMAttributes<
const mergedDisabled = disabled ?? contextDisabled;
const selected = useMemo(() => {
if (model === 'cascader') {
return (contextValue as string)?.startsWith(generateString(value, selectParent)?.toString());
// 最顶级
if(!selectParent){
return contextValue?.toString()?.split('.')?.[0] === value?.toString();
}
// 次级
return (contextValue as string).startsWith(generateString(value, selectParent)?.toString());
}
if (model === 'multiple') {
return false;
Expand Down

1 comment on commit 867f509

@vercel
Copy link

@vercel vercel bot commented on 867f509 Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.