mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Tab: add scroll event (#1730)
This commit is contained in:
parent
d293047164
commit
d32f9a42f3
@ -9,7 +9,7 @@
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('title2')">
|
||||
<van-tabs>
|
||||
<van-tabs sticky @scroll="subscribeSticky">
|
||||
<van-tab v-for="index in 8" :title="$t('tab') + index" :key="index">
|
||||
{{ $t('content') }} {{ index }}
|
||||
</van-tab>
|
||||
@ -111,6 +111,10 @@ export default {
|
||||
|
||||
onClick(index, title) {
|
||||
this.$toast(title);
|
||||
},
|
||||
|
||||
subscribeSticky(e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -137,9 +141,11 @@ export default {
|
||||
.custom-tabwrap .van-tab-active {
|
||||
color: #20a0ff;
|
||||
}
|
||||
|
||||
.custom-tabwrap .van-tabs-nav-bar {
|
||||
background: #20a0ff;
|
||||
}
|
||||
|
||||
.custom-pane {
|
||||
text-align: center;
|
||||
height: 50px;
|
||||
|
@ -169,3 +169,4 @@ In swipeable mode, you can switch tabs with swipe gestrue in the content
|
||||
| click | Triggered when click tab | index:index of current tab,title: tab title |
|
||||
| change | Triggered when active tab changed | index:index of current tab,title: tab title |
|
||||
| disabled | Triggered when click disabled tab | index:index of current tab, title: tab title |
|
||||
| scroll | Triggered when tab scroll | e:scroll arguments |
|
||||
|
@ -171,3 +171,4 @@ export default {
|
||||
| click | 点击标签时触发 | index:标签索引,title:标题 |
|
||||
| change | 当前激活的标签改变时触发 | index:标签索引,title:标题 |
|
||||
| disabled | 点击被禁用的标签时触发 | index:标签索引,title:标题 |
|
||||
| scroll | 滚动时触发 | e:滚动参数 |
|
||||
|
@ -231,6 +231,11 @@ export default create({
|
||||
} else {
|
||||
this.position = '';
|
||||
}
|
||||
const scrollParams = {
|
||||
scrollTop,
|
||||
isFixed: this.position === 'top'
|
||||
};
|
||||
this.$emit('scroll', scrollParams);
|
||||
},
|
||||
|
||||
// update nav bar style
|
||||
|
Loading…
x
Reference in New Issue
Block a user