diff --git a/src/components/IframeDrawer.vue b/src/components/IframeDrawer.vue
index 88322d04..70428af6 100644
--- a/src/components/IframeDrawer.vue
+++ b/src/components/IframeDrawer.vue
@@ -28,12 +28,13 @@ nextTick(() => {
useEventListener(iframeRef.value?.contentWindow, 'popstate', updateCurrentUrl)
})
-onMounted(async () => {
+onMounted(() => {
history.pushState(null, '', props.url)
show.value = true
headerShow.value = true
- await nextTick()
- iframeRef.value?.focus()
+ nextTick(() => {
+ iframeRef.value?.focus()
+ })
})
onBeforeUnmount(() => {
diff --git a/src/components/TopBar/OldTopBar.vue b/src/components/TopBar/OldTopBar.vue
index 51a5089d..053a476e 100644
--- a/src/components/TopBar/OldTopBar.vue
+++ b/src/components/TopBar/OldTopBar.vue
@@ -285,20 +285,21 @@ watch(activatedPage, () => {
toggleTopBarVisible(true)
})
-onMounted(async () => {
+onMounted(() => {
initData()
- await nextTick()
- toggleTopBarVisible(true)
+ nextTick(() => {
+ toggleTopBarVisible(true)
- emitter.off(OVERLAY_SCROLL_BAR_SCROLL)
- if (isHomePage() && !settings.value.useOriginalBilibiliHomepage) {
- emitter.on(OVERLAY_SCROLL_BAR_SCROLL, () => {
- handleScroll()
- })
- }
- else {
- window.addEventListener('scroll', handleScroll)
- }
+ emitter.off(OVERLAY_SCROLL_BAR_SCROLL)
+ if (isHomePage() && !settings.value.useOriginalBilibiliHomepage) {
+ emitter.on(OVERLAY_SCROLL_BAR_SCROLL, () => {
+ handleScroll()
+ })
+ }
+ else {
+ window.addEventListener('scroll', handleScroll)
+ }
+ })
})
onUnmounted(() => {
@@ -519,9 +520,9 @@ defineExpose({
diff --git a/src/components/TopBar/TopBar.vue b/src/components/TopBar/TopBar.vue
index 1f43ac1f..05b0cf45 100644
--- a/src/components/TopBar/TopBar.vue
+++ b/src/components/TopBar/TopBar.vue
@@ -277,20 +277,20 @@ watch(activatedPage, () => {
toggleTopBarVisible(true)
})
-onMounted(async () => {
+onMounted(() => {
initData()
- await nextTick()
- toggleTopBarVisible(true)
-
- emitter.off(OVERLAY_SCROLL_BAR_SCROLL)
- if (isHomePage() && !settings.value.useOriginalBilibiliHomepage) {
- emitter.on(OVERLAY_SCROLL_BAR_SCROLL, () => {
- handleScroll()
- })
- }
- else {
- window.addEventListener('scroll', handleScroll)
- }
+ nextTick(() => {
+ toggleTopBarVisible(true)
+ emitter.off(OVERLAY_SCROLL_BAR_SCROLL)
+ if (isHomePage() && !settings.value.useOriginalBilibiliHomepage) {
+ emitter.on(OVERLAY_SCROLL_BAR_SCROLL, () => {
+ handleScroll()
+ })
+ }
+ else {
+ window.addEventListener('scroll', handleScroll)
+ }
+ })
})
onUnmounted(() => {
diff --git a/src/components/TopBar/components/FavoritesPop.vue b/src/components/TopBar/components/FavoritesPop.vue
index f3309403..f9307d91 100644
--- a/src/components/TopBar/components/FavoritesPop.vue
+++ b/src/components/TopBar/components/FavoritesPop.vue
@@ -44,7 +44,11 @@ watch(activatedMediaId, (newVal: number, oldVal: number) => {
getFavoriteResources()
})
-onMounted(async () => {
+onMounted(() => {
+ initData()
+})
+
+async function initData() {
await getFavoriteCategories()
activatedMediaId.value = favoriteCategories[0].id
activatedFavoriteTitle.value = favoriteCategories[0].title
@@ -67,7 +71,7 @@ onMounted(async () => {
}
})
}
-})
+}
async function getFavoriteCategories() {
await api.favorite.getFavoriteCategories({
diff --git a/src/contentScripts/views/Favorites/Favorites.vue b/src/contentScripts/views/Favorites/Favorites.vue
index ec3681a6..f4eabf36 100644
--- a/src/contentScripts/views/Favorites/Favorites.vue
+++ b/src/contentScripts/views/Favorites/Favorites.vue
@@ -28,12 +28,7 @@ const isLoading = ref(false)
const isFullPageLoading = ref(false)
const noMoreContent = ref(false)
-onMounted(async () => {
- await getFavoriteCategories()
- changeCategory(favoriteCategories[0])
-
- initPageAction()
-
+onMounted(() => {
emitter.off(TOP_BAR_VISIBILITY_CHANGE)
emitter.on(TOP_BAR_VISIBILITY_CHANGE, (val) => {
shouldMoveCtrlBarUp.value = false
@@ -49,8 +44,16 @@ onMounted(async () => {
shouldMoveCtrlBarUp.value = true
}
})
+
+ initPageAction()
+ initData()
})
+async function initData() {
+ await getFavoriteCategories()
+ changeCategory(favoriteCategories[0])
+}
+
onUnmounted(() => {
emitter.off(TOP_BAR_VISIBILITY_CHANGE)
})
diff --git a/src/contentScripts/views/Home/components/Following.vue b/src/contentScripts/views/Home/components/Following.vue
index 579f0f8e..ec093fcf 100644
--- a/src/contentScripts/views/Home/components/Following.vue
+++ b/src/contentScripts/views/Home/components/Following.vue
@@ -41,7 +41,7 @@ const updateBaseline = ref('')
const noMoreContent = ref(false)
const { handleReachBottom, handlePageRefresh, haveScrollbar } = useBewlyApp()
-onMounted(async () => {
+onMounted(() => {
initData()
initPageAction()
})
diff --git a/src/contentScripts/views/Home/components/ForYou.vue b/src/contentScripts/views/Home/components/ForYou.vue
index 72f9f990..4b6707b3 100644
--- a/src/contentScripts/views/Home/components/ForYou.vue
+++ b/src/contentScripts/views/Home/components/ForYou.vue
@@ -97,11 +97,11 @@ watch(() => settings.value.recommendationMode, () => {
initData()
})
-onMounted(async () => {
+onMounted(() => {
// Delay by 0.2 seconds to obtain the `settings.value.recommendationMode` value
// otherwise the `settings.value.recommendationMode` value will be undefined
// i have no idea to fix that...
- setTimeout(async () => {
+ setTimeout(() => {
initData()
}, 200)
diff --git a/src/contentScripts/views/Home/components/Live.vue b/src/contentScripts/views/Home/components/Live.vue
index 900e3ad5..5ae663a0 100644
--- a/src/contentScripts/views/Home/components/Live.vue
+++ b/src/contentScripts/views/Home/components/Live.vue
@@ -37,7 +37,7 @@ const page = ref(1)
const noMoreContent = ref(false)
const { handleReachBottom, handlePageRefresh, haveScrollbar } = useBewlyApp()
-onMounted(async () => {
+onMounted(() => {
initData()
initPageAction()
})
diff --git a/src/contentScripts/views/Home/components/SubscribedSeries.vue b/src/contentScripts/views/Home/components/SubscribedSeries.vue
index 9468c075..e3a3d339 100644
--- a/src/contentScripts/views/Home/components/SubscribedSeries.vue
+++ b/src/contentScripts/views/Home/components/SubscribedSeries.vue
@@ -39,7 +39,7 @@ const noMoreContent = ref(false)
const noMoreContentWarning = ref(false)
const { handleReachBottom, handlePageRefresh, haveScrollbar } = useBewlyApp()
-onMounted(async () => {
+onMounted(() => {
initData()
initPageAction()
})
diff --git a/src/contentScripts/views/Home/components/Trending.vue b/src/contentScripts/views/Home/components/Trending.vue
index d05907c7..c52a3d7e 100644
--- a/src/contentScripts/views/Home/components/Trending.vue
+++ b/src/contentScripts/views/Home/components/Trending.vue
@@ -35,8 +35,8 @@ const pn = ref(1)
const noMoreContent = ref(false)
const { handleReachBottom, handlePageRefresh, haveScrollbar } = useBewlyApp()
-onMounted(async () => {
- await initData()
+onMounted(() => {
+ initData()
initPageAction()
})