mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
docs(Tab): improve docs for sticky @rex-zsd (#1042)
This commit is contained in:
parent
66e845bf12
commit
4912029e2b
@ -116,7 +116,7 @@ Page({
|
||||
通过`sticky`属性可以开启粘性布局,粘性布局下,当 Tab 滚动到顶部时会自动吸顶
|
||||
|
||||
```html
|
||||
<van-tabs sticky>
|
||||
<van-tabs sticky scroll-top="{{ scrollTop }}">
|
||||
<van-tab title="标签 1">内容 1</van-tab>
|
||||
<van-tab title="标签 2">内容 2</van-tab>
|
||||
<van-tab title="标签 3">内容 3</van-tab>
|
||||
@ -124,6 +124,19 @@ Page({
|
||||
</van-tabs>
|
||||
```
|
||||
|
||||
```javascript
|
||||
Page({
|
||||
data: {
|
||||
scrollTop: 0
|
||||
},
|
||||
onPageScroll(event) {
|
||||
this.setData({
|
||||
scrollTop: event.scrollTop
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### 切换动画
|
||||
|
||||
可以通过`animated`来设置是否启用切换tab时的动画。
|
||||
|
Loading…
x
Reference in New Issue
Block a user