[bugfix] Tab: height calc error when use sticky (#493)

This commit is contained in:
neverland 2017-12-29 14:55:46 +08:00 committed by GitHub
parent ef01dd5321
commit 0e951b7beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
<template>
<div class="van-tabs" :class="[`van-tabs--${type}`]">
<div
ref="wrap"
class="van-tabs__wrap"
:class="[`van-tabs__wrap--${position}`, {
'van-tabs--scrollable': scrollable,
@ -133,7 +134,7 @@ export default create({
onScroll() {
const scrollTop = scrollUtils.getScrollTop(this.scrollEl);
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) {
this.position = 'content-bottom';
} else if (scrollTop > elTopToPageTop) {