Skip to content

Commit

Permalink
fix(AFFIX): 修复指定挂载的容器情况下任意外层滚动后导致固定位置偏移的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanlinxin committed Nov 5, 2024
1 parent f5e9fd1 commit 494b34f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/affix/affix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ export default defineComponent({
scrollContainer.value = getScrollContainer(props.container);
on(scrollContainer.value, 'scroll', handleScroll);
on(window, 'resize', handleScroll);
on(window, 'scroll', handleScroll);
binded.value = true;
};

const unbindScroll = () => {
if (!scrollContainer.value || !binded.value) return;
off(scrollContainer.value, 'scroll', handleScroll);
off(window, 'resize', handleScroll);
off(window, 'scroll', handleScroll);
if (rAFId) {
window.cancelAnimationFrame(rAFId);
}
Expand Down

0 comments on commit 494b34f

Please sign in to comment.