diff options
Diffstat (limited to 'packages/frontend/src/components/global')
| -rw-r--r-- | packages/frontend/src/components/global/MkStickyContainer.vue | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/frontend/src/components/global/MkStickyContainer.vue b/packages/frontend/src/components/global/MkStickyContainer.vue index 3f9c1bc353..44c02088da 100644 --- a/packages/frontend/src/components/global/MkStickyContainer.vue +++ b/packages/frontend/src/components/global/MkStickyContainer.vue @@ -32,11 +32,17 @@ const parentStickyBottom = inject<Ref<number>>(CURRENT_STICKY_BOTTOM, ref(0)); provide(CURRENT_STICKY_BOTTOM, $$(childStickyBottom)); const calc = () => { - childStickyTop = parentStickyTop.value + headerEl.offsetHeight; - headerHeight = headerEl.offsetHeight.toString(); + // コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる + if (headerEl != null) { + childStickyTop = parentStickyTop.value + headerEl.offsetHeight; + headerHeight = headerEl.offsetHeight.toString(); + } - childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight; - footerHeight = footerEl.offsetHeight.toString(); + // コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる + if (footerEl != null) { + childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight; + footerHeight = footerEl.offsetHeight.toString(); + } }; const observer = new ResizeObserver(() => { |