fix(client): prevent null reference error
This commit is contained in:
parent
436190966c
commit
3066a133ac
1 changed files with 10 additions and 4 deletions
|
@ -32,11 +32,17 @@ const parentStickyBottom = inject<Ref<number>>(CURRENT_STICKY_BOTTOM, ref(0));
|
||||||
provide(CURRENT_STICKY_BOTTOM, $$(childStickyBottom));
|
provide(CURRENT_STICKY_BOTTOM, $$(childStickyBottom));
|
||||||
|
|
||||||
const calc = () => {
|
const calc = () => {
|
||||||
|
// コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる
|
||||||
|
if (headerEl != null) {
|
||||||
childStickyTop = parentStickyTop.value + headerEl.offsetHeight;
|
childStickyTop = parentStickyTop.value + headerEl.offsetHeight;
|
||||||
headerHeight = headerEl.offsetHeight.toString();
|
headerHeight = headerEl.offsetHeight.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// コンポーネントが表示されてないけどKeepAliveで残ってる場合などは null になる
|
||||||
|
if (footerEl != null) {
|
||||||
childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight;
|
childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight;
|
||||||
footerHeight = footerEl.offsetHeight.toString();
|
footerHeight = footerEl.offsetHeight.toString();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const observer = new ResizeObserver(() => {
|
const observer = new ResizeObserver(() => {
|
||||||
|
|
Loading…
Reference in a new issue