[Improvement] Tab: scroll to corrent position when sticky & tab change (#389)
This commit is contained in:
+11
-3
@@ -79,6 +79,11 @@ export default {
|
||||
curActive() {
|
||||
this.scrollIntoView();
|
||||
this.setNavBar();
|
||||
|
||||
// scroll to correct position
|
||||
if (this.position === 'page-top' || this.position === 'content-bottom') {
|
||||
scrollUtils.setScrollTop(this.scrollEl, scrollUtils.getElementTop(this.$el));
|
||||
}
|
||||
},
|
||||
|
||||
sticky(isSticky) {
|
||||
@@ -90,9 +95,12 @@ export default {
|
||||
this.correctActive(this.active);
|
||||
this.setNavBar();
|
||||
|
||||
if (this.sticky) {
|
||||
this.scrollHandler(true);
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
if (this.sticky) {
|
||||
this.scrollHandler(true);
|
||||
}
|
||||
this.scrollIntoView();
|
||||
});
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
|
||||
@@ -73,11 +73,12 @@ $van-tabs-card-height: 28px;
|
||||
|
||||
.van-tabs__nav {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
background-color: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user