Skip to content

Commit

Permalink
fix(tabs): 修复最后一项disabled时卡死问题. (#2503) (#2523)
Browse files Browse the repository at this point in the history
* fix(tabs): 修复最后一项disabled时卡死问题. (#2503)

fix #2503

* test: update snapshots

---------

Co-authored-by: anlyyao <[email protected]>
  • Loading branch information
byq1213 and anlyyao authored Jan 16, 2024
1 parent 8fb4efd commit fb17d51
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tabs/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ export default class Tabs extends SuperComponent {
const len = tabs.length;
for (let i = step; currentIndex + step >= 0 && currentIndex + step < len; i += step) {
const newIndex = currentIndex + i;
if (newIndex >= 0 && newIndex < len && tabs[newIndex] && !tabs[newIndex].disabled) {
return newIndex;
if (newIndex >= 0 && newIndex < len && tabs[newIndex]) {
if (!tabs[newIndex].disabled) {
return newIndex;
}
} else {
return currentIndex;
}
}
return -1;
Expand Down

0 comments on commit fb17d51

Please sign in to comment.