Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/fix issue 5135 #5398

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions packages/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ VantComponent({
scrollable:
this.children.length > data.swipeThreshold || !data.ellipsis,
});

this.resize();
Copy link
Contributor

Choose a reason for hiding this comment

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

这个在考虑下,setCurrentIndex 中也会触发 resize 执行,不应该在这里直接触发 resize

this.setCurrentIndexByName(data.active || this.getCurrentName());
},

Expand Down Expand Up @@ -196,13 +196,7 @@ VantComponent({
});
});

if (currentIndex === data.currentIndex) {
if (!data.inited) {
this.resize();
}
return;
}

if (currentIndex === data.currentIndex) return;
const shouldEmitChange = data.currentIndex !== null;
this.setData({ currentIndex });

Expand Down