Closed AdvanceOrange closed 3 years ago
[https://codesandbox.io/S/ng-zorro-antd-ivy-forked-hmeb3](https://codesandbox.io/s/ng- zorro-antd-ivy-forked-hmeb3)
Repair, Affix should cancel fixation
Affix solids change in the height of the WINDOW, when the scroll bar disappears, the fixed state has not changed
ENVIRONMENT | INFO |
---|---|
Ng-Zorro-ANTD | 11.2.0 |
Browser | Chrome |
@AdvanceOrange Hi there. I didn't see that the Affix component is used in your reproduction. Could you please check that?
@AdvanceOrange你好。我没有看到您的复制中使用了 Affix 组件。你能检查一下吗? 好的,这是新的链接 https://codesandbox.io/s/ng-zorro-antd-ivy-forked-0sqox
看了源码的实现方式,原因在于nzTarget内容的变化无法触发位置更新,是否可以考虑使用ResizeObserver(不支持IE11)监控document.body或nzTarget的高度变化,示例如下
const observer = new ResizeObserver(()=>{ this.updatePosition() }; //可以结合RXJS减少更新频率 observer.observe(document.body);
看了源码的实现方式,原因在于nzTarget内容的变化无法触发位置更新,是否可以考虑使用ResizeObserver(不支持IE11)监控document.body或nzTarget的高度变化,示例如下
const observer = new ResizeObserver(()=>{ this.updatePosition() }; //可以结合RXJS减少更新频率 observer.observe(document.body);
是的,欢迎提交 PR
Hello @AdvanceOrange. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please fill the Pull Request Template here, provide documentation/test cases if needed and make sure CI passed, we will review it soon. Appreciate it advance and we are looking forward to your contribution!
你好 @AdvanceOrange, 我们完全同意你的提议/反馈,欢迎直接在此仓库 创建一个 Pull Request 来解决这个问题。请务必填写 Pull Request 内的预设模板,提供改动所需相应的测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献!
Reproduction link
https://codesandbox.io/s/ng-zorro-antd-ivy-forked-hmeb3
Steps to reproduce
What is expected?
修复,affix应该取消固定
What is actually happening?
Affix固钉在window高度发生改变,滚动条消失时,固定状态没有改变