mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-24 23:49:14 +08:00
[bugfix] Tab: height calc error when use sticky (#493)
This commit is contained in:
parent
ef01dd5321
commit
0e951b7beb
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="van-tabs" :class="[`van-tabs--${type}`]">
|
<div class="van-tabs" :class="[`van-tabs--${type}`]">
|
||||||
<div
|
<div
|
||||||
|
ref="wrap"
|
||||||
class="van-tabs__wrap"
|
class="van-tabs__wrap"
|
||||||
:class="[`van-tabs__wrap--${position}`, {
|
:class="[`van-tabs__wrap--${position}`, {
|
||||||
'van-tabs--scrollable': scrollable,
|
'van-tabs--scrollable': scrollable,
|
||||||
@ -133,7 +134,7 @@ export default create({
|
|||||||
onScroll() {
|
onScroll() {
|
||||||
const scrollTop = scrollUtils.getScrollTop(this.scrollEl);
|
const scrollTop = scrollUtils.getScrollTop(this.scrollEl);
|
||||||
const elTopToPageTop = scrollUtils.getElementTop(this.$el);
|
const elTopToPageTop = scrollUtils.getElementTop(this.$el);
|
||||||
const elBottomToPageTop = elTopToPageTop + this.$el.offsetHeight - this.$refs.nav.offsetHeight;
|
const elBottomToPageTop = elTopToPageTop + this.$el.offsetHeight - this.$refs.wrap.offsetHeight;
|
||||||
if (scrollTop > elBottomToPageTop) {
|
if (scrollTop > elBottomToPageTop) {
|
||||||
this.position = 'content-bottom';
|
this.position = 'content-bottom';
|
||||||
} else if (scrollTop > elTopToPageTop) {
|
} else if (scrollTop > elTopToPageTop) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user