diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index a23a3ff0..17c61a90 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -180,10 +180,9 @@ function handleDockItemClick(dockItem: DockItem) { } else { if (isHomePage()) { - // Replace NextTick with setTimeout(200), otherwise osInstance in function 'changeActivatePage' will be undefined - setTimeout(() => { + nextTick(() => { changeActivatePage(dockItem.page) - }, 200) + }) } else { location.href = `https://www.bilibili.com/?page=${dockItem.page}` diff --git a/src/contentScripts/views/Favorites/Favorites.vue b/src/contentScripts/views/Favorites/Favorites.vue index f826561c..ea17850a 100644 --- a/src/contentScripts/views/Favorites/Favorites.vue +++ b/src/contentScripts/views/Favorites/Favorites.vue @@ -127,7 +127,7 @@ async function getFavoriteResources( if (!res.data.medias) noMoreContent.value = true - if (!haveScrollbar() && !noMoreContent.value) + if (!await haveScrollbar() && !noMoreContent.value) await getFavoriteResources(selectedCategory.value!.id, ++currentPageNum.value, keyword) } } diff --git a/src/contentScripts/views/History/History.vue b/src/contentScripts/views/History/History.vue index 0f4b23f8..18979631 100644 --- a/src/contentScripts/views/History/History.vue +++ b/src/contentScripts/views/History/History.vue @@ -64,7 +64,7 @@ function getHistoryList() { ? historyList[historyList.length - 1].view_at : 0, }) - .then((res: HistoryResult) => { + .then(async (res: HistoryResult) => { if (res.code === 0) { if (Array.isArray(res.data.list) && res.data.list.length > 0) historyList.push(...res.data.list) @@ -77,7 +77,7 @@ function getHistoryList() { noMoreContent.value = false - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getHistoryList() } } diff --git a/src/contentScripts/views/Home/components/Following.vue b/src/contentScripts/views/Home/components/Following.vue index 898da295..c7d43223 100644 --- a/src/contentScripts/views/Home/components/Following.vue +++ b/src/contentScripts/views/Home/components/Following.vue @@ -242,7 +242,7 @@ async function getFollowedUsersVideos() { }) } - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getFollowedUsersVideos() } } diff --git a/src/contentScripts/views/Home/components/ForYou.vue b/src/contentScripts/views/Home/components/ForYou.vue index 87348128..ee0c8c86 100644 --- a/src/contentScripts/views/Home/components/ForYou.vue +++ b/src/contentScripts/views/Home/components/ForYou.vue @@ -227,7 +227,7 @@ async function getRecommendVideos() { if (!needToLoginFirst.value) { await nextTick() - if (!haveScrollbar() || filledItems.length < PAGE_SIZE || filledItems.length < 1) { + if (!await haveScrollbar() || filledItems.length < PAGE_SIZE || filledItems.length < 1) { getRecommendVideos() } } @@ -306,7 +306,7 @@ async function getAppRecommendVideos() { if (!needToLoginFirst.value) { await nextTick() - if (!haveScrollbar() || filledItems.length < PAGE_SIZE || filledItems.length < 1) { + if (!await haveScrollbar() || filledItems.length < PAGE_SIZE || filledItems.length < 1) { getAppRecommendVideos() } } diff --git a/src/contentScripts/views/Home/components/Live.vue b/src/contentScripts/views/Home/components/Live.vue index 57c3c56f..c9c61bf1 100644 --- a/src/contentScripts/views/Home/components/Live.vue +++ b/src/contentScripts/views/Home/components/Live.vue @@ -139,7 +139,7 @@ async function getFollowedUsersVideos() { }) } - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getFollowedUsersVideos() } } diff --git a/src/contentScripts/views/Home/components/SubscribedSeries.vue b/src/contentScripts/views/Home/components/SubscribedSeries.vue index 1a077fdc..813a3112 100644 --- a/src/contentScripts/views/Home/components/SubscribedSeries.vue +++ b/src/contentScripts/views/Home/components/SubscribedSeries.vue @@ -144,7 +144,7 @@ async function getFollowedUsersVideos() { }) } - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getFollowedUsersVideos() } } diff --git a/src/contentScripts/views/Home/components/Trending.vue b/src/contentScripts/views/Home/components/Trending.vue index 33af7d34..480303bd 100644 --- a/src/contentScripts/views/Home/components/Trending.vue +++ b/src/contentScripts/views/Home/components/Trending.vue @@ -114,7 +114,7 @@ async function getTrendingVideos() { }) } - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getTrendingVideos() } } diff --git a/src/contentScripts/views/WatchLater/WatchLater.vue b/src/contentScripts/views/WatchLater/WatchLater.vue index 9de6a2a3..be747973 100644 --- a/src/contentScripts/views/WatchLater/WatchLater.vue +++ b/src/contentScripts/views/WatchLater/WatchLater.vue @@ -70,7 +70,7 @@ async function getAllWatchLaterList() { } } -function getCurrentWatchLaterList() { +async function getCurrentWatchLaterList() { const allWatchLaterListCopy = JSON.parse(JSON.stringify(allWatchLaterList.value)) const currentList = allWatchLaterListCopy.slice((pageNum.value - 1) * 10, pageNum.value * 10) @@ -81,7 +81,7 @@ function getCurrentWatchLaterList() { pageNum.value++ currentWatchLaterList.value.push(...currentList) - if (!haveScrollbar() && !noMoreContent.value) { + if (!await haveScrollbar() && !noMoreContent.value) { getCurrentWatchLaterList() } }