Vant: [Feature Request] Sticky 粘性布局新增吸底功能

Created on 10 Nov 2020  ·  4Comments  ·  Source: youzan/vant

这个功能解决了什么问题

解决了部分组件想要吸底的需求

描述您想要的解决方案

Sticky组件增加一个配置项,可以指定吸顶还是吸底

建议的API是什么样的

type='top'|'bottom'

👏 PR welcome 💡 feature

Most helpful comment

I would like to make this PR.

All 4 comments

I would like to make this PR.

@Ther-su @chenjiahan 看了下Sticky的API原先设计理念应该是默认顶部吸顶的吧,如果要加的话是否要增加两个API prop

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| offset-bottom | 吸顶时与底部的距离,支持 px vw vh rem 单位,默认 px | _number \| string_ | 0 |
| type | 吸附方向,支持 top bottom | string | top |

感觉更好的设计是offset-top能和offset-bottom合并

更好的设计是offset-top能和offset-bottom合并

是的,不过之前命名的时候没考虑吸底的情况,所以只能新增一个 offset-bottom 属性咯

type 这个命名不是很直观,可以考虑重命名为 position

@chenjiahan 是的,我也感觉type这个命名不够直观

Was this page helpful?
0 / 5 - 0 ratings