mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Tab: sticky in scroll element (#1496)
This commit is contained in:
parent
61bd31406d
commit
0b735ac639
@ -107,7 +107,7 @@ export default create({
|
|||||||
|
|
||||||
// scroll to correct position
|
// scroll to correct position
|
||||||
if (this.position === 'page-top' || this.position === 'content-bottom') {
|
if (this.position === 'page-top' || this.position === 'content-bottom') {
|
||||||
scrollUtils.setScrollTop(this.scrollEl, scrollUtils.getElementTop(this.$el));
|
scrollUtils.setScrollTop(window, scrollUtils.getElementTop(this.$el));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ export default create({
|
|||||||
|
|
||||||
// adjust tab position
|
// adjust tab position
|
||||||
onScroll() {
|
onScroll() {
|
||||||
const scrollTop = scrollUtils.getScrollTop(this.scrollEl);
|
const scrollTop = scrollUtils.getScrollTop(window);
|
||||||
const elTopToPageTop = scrollUtils.getElementTop(this.$el);
|
const elTopToPageTop = scrollUtils.getElementTop(this.$el);
|
||||||
const elBottomToPageTop = elTopToPageTop + this.$el.offsetHeight - this.$refs.wrap.offsetHeight;
|
const elBottomToPageTop = elTopToPageTop + this.$el.offsetHeight - this.$refs.wrap.offsetHeight;
|
||||||
if (scrollTop > elBottomToPageTop) {
|
if (scrollTop > elBottomToPageTop) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user