[Improvement] Tab: scroll to corrent position when sticky & tab change (#389)

This commit is contained in:
neverland 2017-12-07 15:28:27 +08:00 committed by GitHub
parent 0d64d5ea49
commit d6c6e9d742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -11,16 +11,16 @@
**Bug Fixes**
- 修复 Popup overlayClass 类型错误 [\#374](https://github.com/youzan/vant/pull/374) [@chenjiahan](https://github.com/chenjiahan)
- 修复 Filed number 类型输入值过滤 [\#386](https://github.com/youzan/vant/pull/386) [@chenjiahan](https://github.com/chenjiahan)
- 修复 Icon 'new' 显示问题 [\#381](https://github.com/youzan/vant/pull/381) ([@pangxie1991](https://github.com/pangxie1991))
- 修复 Icon 'new' 显示问题 [\#381](https://github.com/youzan/vant/pull/381) [@pangxie1991](https://github.com/pangxie1991)
- 修复 Sku 按钮圆角问题 [\#378](https://github.com/youzan/vant/pull/378) [@chenjiahan](https://github.com/chenjiahan)
- 修复 Radio & Checkbox 禁用态样式 [\#383](https://github.com/youzan/vant/pull/383) [@chenjiahan](https://github.com/chenjiahan)
- 修复 Filed disabled 在安卓下的显示问题 [\#388](https://github.com/youzan/vant/pull/388) [@chenjiahan](https://github.com/chenjiahan)
### [0.11.5](https://github.com/youzan/vant/tree/v0.11.5)
`2017-12-04`
**Improvements**
- Coupon Cell 右侧文案 [\#371](https://github.com/youzan/vant/pull/371) [@chenjiahan](https://github.com/chenjiahan)
- Coupon Cell 右侧文案 [\#371](https://github.com/youzan/vant/pull/371) [@chenjiahan](https://github.com/chenjiahan)
- GoodsAction: 支持国际化 [\#367](https://github.com/youzan/vant/pull/367) [@chenjiahan](https://github.com/chenjiahan)
- 增加 Props 命名规范相关文档 [\#366](https://github.com/youzan/vant/pull/366) [@chenjiahan](https://github.com/chenjiahan)

View File

@ -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() {

View File

@ -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;
}
}
}