Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sticky吸顶组件有待改善 #411

Open
babaysite opened this issue Jul 24, 2020 · 0 comments
Open

sticky吸顶组件有待改善 #411

babaysite opened this issue Jul 24, 2020 · 0 comments

Comments

@babaysite
Copy link

  1. 吸顶isFixed 判断通过目标容器view的 top height 以及窗口scrollTop 判断,这里有几个问题:
    a. updateDataChange 更新数据并未触发更新top
    b. navigationStyle custom 时 吸顶判断scrollTop 和 top 相对位置就变更了,固定位置应根据properties传参(假定fixedTop)来实现吸顶位置(上面会有自定义头部)
    ** 判断isFixed 里的top 实际获得应该是updateScrollTopChange 函数下 query.select( className ).boundingClientRect((res) 拿到scrollTop + res.top 的值 即已滚动高度 + 容器距离窗口顶部高度距离 那么判断条件变更为:
    const isFixed = ( scrollTop >= top - fixedTop && scrollTop < top + height - fixedTop) ? true : false
    c. 另外部分options.addGlobalClass = true 加入方便样式覆盖,开发上会获得更好的体验

ps. 望采纳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant