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

fix(Tab): tab(with sticky prop) loss 'fixed' classname after switch tab #12547

Merged
merged 2 commits into from
Jan 6, 2024

Conversation

shenjingnan
Copy link
Contributor

@shenjingnan shenjingnan commented Jan 5, 2024

fix: #12535

边界场景(需要出现两个吸顶)

调整 <Sticky /> 判断 offset === root top 时的吸顶逻辑:
调整前:逻辑是两者相等时认为可以解除吸顶
调整后:逻辑是保持吸顶,直到 offset < root top(即用户开始往上滚内容👆🏻)

这样做能兼容 <Tabs sticky /> 当用户什么都不做时,只是切换吸顶tab时的情况(切换tab时offset === root top)


issue 本身使用的也有问题,<VanNavBar fixed title="pageTitle" /> 本身也是固定在顶部的,必定会出现重叠的情况,最好的做法是增加 tab 偏移量,例如 <Tabs sticky :offset-top="46" />

@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (b5645ee) 89.88% compared to head (19a6d32) 89.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12547      +/-   ##
==========================================
+ Coverage   89.88%   89.91%   +0.03%     
==========================================
  Files         257      257              
  Lines        6819     6820       +1     
  Branches     1653     1653              
==========================================
+ Hits         6129     6132       +3     
+ Misses        367      365       -2     
  Partials      323      323              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chenjiahan chenjiahan merged commit b6a1c00 into youzan:main Jan 6, 2024
@chenjiahan
Copy link
Member

LGTM 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] van-tabs 使用 sticky 后,切换 tab sticky 展示问题
3 participants