diff --git a/src/contentScripts/views/Home/Home.vue b/src/contentScripts/views/Home/Home.vue
index 4707c31d..fc03f2e3 100644
--- a/src/contentScripts/views/Home/Home.vue
+++ b/src/contentScripts/views/Home/Home.vue
@@ -1,6 +1,5 @@
@@ -146,7 +156,8 @@ onUnmounted(() => {
px-4 lh-35px bg="$bew-elevated-1 hover:$bew-elevated-1-hover" backdrop-glass rounded="$bew-radius"
cursor-pointer shadow="$bew-shadow-1" box-border border="1 $bew-border-color" duration-300
:class="{ 'tab-activated': activatedPage === tab.value }"
- @click="activatedPage = tab.value"
+ :style="{ opacity: activatedPage !== tab.value && tabContentLoading ? 0.4 : 1 }"
+ @click="handleChangeTab(tab)"
>
{{ tab.label }}
@@ -155,7 +166,11 @@ onUnmounted(() => {
-
+
diff --git a/src/contentScripts/views/Home/components/Following.vue b/src/contentScripts/views/Home/components/Following.vue
index f1db2a10..db2f3961 100644
--- a/src/contentScripts/views/Home/components/Following.vue
+++ b/src/contentScripts/views/Home/components/Following.vue
@@ -2,6 +2,11 @@
import type { Ref } from 'vue'
import type { DataItem as MomentItem, MomentResult } from '~/models/moment/moment'
+const emit = defineEmits<{
+ (e: 'beforeLoading'): void
+ (e: 'afterLoading'): void
+}>()
+
const videoList = reactive([])
const isLoading = ref(false)
const needToLoginFirst = ref(false)
@@ -54,6 +59,7 @@ async function getFollowedUsersVideos() {
return
}
+ emit('beforeLoading')
isLoading.value = true
try {
const response: MomentResult = await browser.runtime.sendMessage({
@@ -94,6 +100,7 @@ async function getFollowedUsersVideos() {
}
finally {
isLoading.value = false
+ emit('afterLoading')
}
}
diff --git a/src/contentScripts/views/Home/components/ForYou.vue b/src/contentScripts/views/Home/components/ForYou.vue
index df60ef6c..7ca8158a 100644
--- a/src/contentScripts/views/Home/components/ForYou.vue
+++ b/src/contentScripts/views/Home/components/ForYou.vue
@@ -6,6 +6,11 @@ import { accessKey, settings } from '~/logic'
import { LanguageType } from '~/enums/appEnums'
import { TVAppKey } from '~/utils/authProvider'
+const emit = defineEmits<{
+ (e: 'beforeLoading'): void
+ (e: 'afterLoading'): void
+}>()
+
const videoList = reactive([])
const appVideoList = reactive([])
const isLoading = ref(true)
@@ -82,6 +87,7 @@ function initPageAction() {
}
async function getRecommendVideos() {
+ emit('beforeLoading')
isLoading.value = true
try {
const response: forYouResult = await browser.runtime.sendMessage({
@@ -116,10 +122,12 @@ async function getRecommendVideos() {
}
finally {
isLoading.value = false
+ emit('afterLoading')
}
}
async function getAppRecommendVideos() {
+ emit('beforeLoading')
isLoading.value = true
try {
const response: AppForYouResult = await browser.runtime.sendMessage({
@@ -155,6 +163,7 @@ async function getAppRecommendVideos() {
}
finally {
isLoading.value = false
+ emit('afterLoading')
}
}
diff --git a/src/contentScripts/views/Home/components/Ranking.vue b/src/contentScripts/views/Home/components/Ranking.vue
index 60aba0b3..d316d940 100644
--- a/src/contentScripts/views/Home/components/Ranking.vue
+++ b/src/contentScripts/views/Home/components/Ranking.vue
@@ -6,6 +6,11 @@ import type { List as RankingPgcItem, RankingPgcResult } from '~/models/video/ra
import { settings } from '~/logic'
import emitter from '~/utils/mitt'
+const emit = defineEmits<{
+ (e: 'beforeLoading'): void
+ (e: 'afterLoading'): void
+}>()
+
const { t } = useI18n()
const { handleBackToTop, handlePageRefresh } = useBewlyApp()
@@ -94,6 +99,7 @@ onBeforeUnmount(() => {
function getRankingVideos() {
videoList.length = 0
+ emit('beforeLoading')
isLoading.value = true
browser.runtime.sendMessage({
contentScriptQuery: 'getRankingVideos',
@@ -104,7 +110,10 @@ function getRankingVideos() {
const { list } = response.data
Object.assign(videoList, list)
}
- }).finally(() => isLoading.value = false)
+ }).finally(() => {
+ isLoading.value = false
+ emit('afterLoading')
+ })
}
function getRankingPgc() {
diff --git a/src/contentScripts/views/Home/components/SubscribedSeries.vue b/src/contentScripts/views/Home/components/SubscribedSeries.vue
index 0cc92fc6..26bac375 100644
--- a/src/contentScripts/views/Home/components/SubscribedSeries.vue
+++ b/src/contentScripts/views/Home/components/SubscribedSeries.vue
@@ -2,6 +2,11 @@
import type { Ref } from 'vue'
import type { DataItem as MomentItem, MomentResult } from '~/models/moment/moment'
+const emit = defineEmits<{
+ (e: 'beforeLoading'): void
+ (e: 'afterLoading'): void
+}>()
+
const momentList = reactive([])
const isLoading = ref(false)
const needToLoginFirst = ref(false)
@@ -59,6 +64,7 @@ async function getFollowedUsersVideos() {
return
}
+ emit('beforeLoading')
isLoading.value = true
try {
const response: MomentResult = await browser.runtime.sendMessage({
@@ -99,6 +105,7 @@ async function getFollowedUsersVideos() {
}
finally {
isLoading.value = false
+ emit('afterLoading')
}
}
diff --git a/src/contentScripts/views/Home/components/Trending.vue b/src/contentScripts/views/Home/components/Trending.vue
index 64deb2db..aa660dc4 100644
--- a/src/contentScripts/views/Home/components/Trending.vue
+++ b/src/contentScripts/views/Home/components/Trending.vue
@@ -2,6 +2,11 @@
import type { Ref } from 'vue'
import type { TrendingResult, List as VideoItem } from '~/models/video/trending'
+const emit = defineEmits<{
+ (e: 'beforeLoading'): void
+ (e: 'afterLoading'): void
+}>()
+
const videoList = reactive([])
const isLoading = ref(false)
const containerRef = ref() as Ref
@@ -32,6 +37,7 @@ function initPageAction() {
}
async function getTrendingVideos() {
+ emit('beforeLoading')
isLoading.value = true
try {
const response: TrendingResult = await browser.runtime.sendMessage({
@@ -59,6 +65,7 @@ async function getTrendingVideos() {
}
finally {
isLoading.value = false
+ emit('afterLoading')
}
}