fix(client): prevent null reference error

This commit is contained in:
syuilo 2023-03-03 11:43:53 +09:00
parent 436190966c
commit 3066a133ac

View File

@ -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 = () => {
childStickyTop = parentStickyTop.value + headerEl.offsetHeight; // KeepAlive null
headerHeight = headerEl.offsetHeight.toString(); if (headerEl != null) {
childStickyTop = parentStickyTop.value + headerEl.offsetHeight;
headerHeight = headerEl.offsetHeight.toString();
}
childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight; // KeepAlive null
footerHeight = footerEl.offsetHeight.toString(); if (footerEl != null) {
childStickyBottom = parentStickyBottom.value + footerEl.offsetHeight;
footerHeight = footerEl.offsetHeight.toString();
}
}; };
const observer = new ResizeObserver(() => { const observer = new ResizeObserver(() => {