diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 29743f4c..020a0c3b 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -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