Skip to content

Commit

Permalink
fix(Cascader): ensure component correctly positions to initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Feb 13, 2025
1 parent d0bb14e commit 4399e36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cascader/cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ export default defineComponent({
const getIndexesByValue = (options: any, value: any) => {
const keys = props.keys as KeysType;
for (let i = 0; i < options.length; i++) {
if (lodashGet(options, options[i][keys?.value ?? 'value']) === value) {
if (lodashGet(options[i], keys?.value ?? 'value') === value) {
return [i];
}
if (lodashGet(options, options[i][keys?.children ?? 'children'])) {
const res: any = getIndexesByValue(lodashGet(options, options[i][keys?.children ?? 'children']), value);
if (lodashGet(options[i], keys?.children ?? 'children')) {
const res: any = getIndexesByValue(lodashGet(options[i], keys?.children ?? 'children'), value);
if (res) {
return [i, ...res];
}
Expand Down

0 comments on commit 4399e36

Please # to comment.