feat:优化TheMovieDbView组件的watch逻辑

This commit is contained in:
jxxghp
2025-02-10 16:46:43 +08:00
parent 68c14c24b8
commit 632dfbaf10
+1 -8
View File
@@ -104,30 +104,23 @@ watch(type, () => {
if (!type.value) { if (!type.value) {
type.value = 'movies' type.value = 'movies'
} }
let refresh = true
if (type.value === 'movies') { if (type.value === 'movies') {
if (!tmdbSortDict[filterParams.sort_by]) { if (!tmdbSortDict[filterParams.sort_by]) {
filterParams.sort_by = 'popularity.desc' filterParams.sort_by = 'popularity.desc'
refresh = false
} }
if (!tmdbMovieGenreDict[filterParams.with_genres]) { if (!tmdbMovieGenreDict[filterParams.with_genres]) {
filterParams.with_genres = '' filterParams.with_genres = ''
refresh = false
} }
} }
if (type.value === 'tvs') { if (type.value === 'tvs') {
if (!tmdbTvSortDict[filterParams.sort_by]) { if (!tmdbTvSortDict[filterParams.sort_by]) {
filterParams.sort_by = 'popularity.desc' filterParams.sort_by = 'popularity.desc'
refresh = false
} }
if (!tmdbTvGenreDict[filterParams.with_genres]) { if (!tmdbTvGenreDict[filterParams.with_genres]) {
filterParams.with_genres = '' filterParams.with_genres = ''
refresh = false
} }
} }
if (refresh) { currentKey.value++
currentKey.value++
}
}) })
// 过滤参数变化 // 过滤参数变化