mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix: make haveScrollbar() async in multiple components
This change updates several components to use an async version of `haveScrollbar()`, ensuring proper handling of scrollbar detection across different views like Favorites, History, Home components, and WatchLater.
This commit is contained in:
@@ -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}`
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ async function getFollowedUsersVideos() {
|
||||
})
|
||||
}
|
||||
|
||||
if (!haveScrollbar() && !noMoreContent.value) {
|
||||
if (!await haveScrollbar() && !noMoreContent.value) {
|
||||
getFollowedUsersVideos()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ async function getFollowedUsersVideos() {
|
||||
})
|
||||
}
|
||||
|
||||
if (!haveScrollbar() && !noMoreContent.value) {
|
||||
if (!await haveScrollbar() && !noMoreContent.value) {
|
||||
getFollowedUsersVideos()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ async function getFollowedUsersVideos() {
|
||||
})
|
||||
}
|
||||
|
||||
if (!haveScrollbar() && !noMoreContent.value) {
|
||||
if (!await haveScrollbar() && !noMoreContent.value) {
|
||||
getFollowedUsersVideos()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ async function getTrendingVideos() {
|
||||
})
|
||||
}
|
||||
|
||||
if (!haveScrollbar() && !noMoreContent.value) {
|
||||
if (!await haveScrollbar() && !noMoreContent.value) {
|
||||
getTrendingVideos()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user