Skip to content

Commit f399c2f

Browse files
authored
fix: handle undefined scrollContainer values to prevent errors (#39)
1 parent 184509f commit f399c2f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/smart/Windows.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,11 @@ watch(
348348
// We still need setTimeout here because the element might not be fully in position yet
349349
setTimeout(() => {
350350
const { scrollWidth, clientWidth, scrollLeft } =
351-
scrollContainer.value!
351+
scrollContainer.value || {
352+
scrollWidth: 0,
353+
clientWidth: 0,
354+
scrollLeft: 0,
355+
}
352356
const maxScroll = scrollWidth - clientWidth
353357
thumbPosition.value = (scrollLeft / maxScroll) * MAX_SCROLL_VALUE
354358
}, 300)

0 commit comments

Comments
 (0)