Skip to content

Commit b8dea51

Browse files
committed
fix(affix): fix affix test error
1 parent 6e096e7 commit b8dea51

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/affix/affix.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ export default defineComponent({
3030
} else {
3131
_containerHeight = scrollContainer.value.clientHeight;
3232
}
33-
if (!instance.ctx || instance.ctx.$el) return;
33+
if (!instance.ctx || instance.ctx.$el) {
34+
handleScroll();
35+
return;
36+
}
3437
// 需要减掉当前节点的高度,对比的高度应该从 border-top 比对开始
3538
containerHeight.value = _containerHeight - (instance.ctx.$el?.clientHeight || 0);
36-
if (instance.ctx.$el) return;
3739
// 被包裹的子节点宽高
3840
const { clientWidth, clientHeight } = instance.ctx.$el?.querySelector(`.${name}`) || instance.ctx.$el;
3941
oldWidthHeight.value = { width: `${clientWidth}px`, height: `${clientHeight}px` };

0 commit comments

Comments
 (0)