fix: resolve osInstance is null in haveScrollbar() (#1306)

Co-authored-by: EkkoLee98 <ekkoli@addcn.com>
This commit is contained in:
EkkoLee
2025-02-11 17:34:41 +08:00
committed by GitHub
parent 2135106b8a
commit b84936a479

View File

@@ -264,9 +264,12 @@ function openIframeDrawer(url: string) {
async function haveScrollbar() {
await nextTick()
const osInstance = scrollbarRef.value?.osInstance()
const { viewport } = osInstance.elements()
const { scrollHeight } = viewport // get scroll offset
return scrollHeight > window.innerHeight
// If the scrollbarRef is not ready, return false
if (osInstance) {
const { viewport } = osInstance.elements()
const { scrollHeight } = viewport // get scroll offset
return scrollHeight > window.innerHeight
}
}
// In drawer video, watch btn className changed and post message to parent