diff --git a/src/pages/discover.vue b/src/pages/discover.vue index 1e337383..1be59c47 100644 --- a/src/pages/discover.vue +++ b/src/pages/discover.vue @@ -123,6 +123,23 @@ async function saveTabOrder() { // 使用动态标签页 const { registerHeaderTab } = useDynamicHeaderTab() +// 注册动态标签页 +registerHeaderTab({ + items: discoverTabItems, // 传递computed值,而不是.value + modelValue: activeTab, + appendButtons: [ + { + icon: 'mdi-order-alphabetical-ascending', + variant: 'text', + color: 'grey', + class: 'settings-icon-button', + action: () => { + orderConfigDialog.value = true + }, + }, + ], +}) + onBeforeMount(async () => { initDiscoverTabs() await loadOrderConfig() @@ -135,22 +152,6 @@ onMounted(() => { if (discoverTabs.value.length > 0) { activeTab.value = discoverTabs.value[0].mediaid_prefix } - // 注册动态标签页 - registerHeaderTab({ - items: discoverTabItems, // 传递computed值,而不是.value - modelValue: activeTab, - appendButtons: [ - { - icon: 'mdi-order-alphabetical-ascending', - variant: 'text', - color: 'grey', - class: 'settings-icon-button', - action: () => { - orderConfigDialog.value = true - }, - }, - ], - }) }) onActivated(async () => { diff --git a/src/pages/downloading.vue b/src/pages/downloading.vue index a7bd308b..df9b02f2 100644 --- a/src/pages/downloading.vue +++ b/src/pages/downloading.vue @@ -41,7 +41,7 @@ async function loadDownloaderSetting() { const registerTabs = () => { if (downloaderItems.value.length > 0) { registerHeaderTab({ - items: downloaderItems.value, + items: downloaderItems, modelValue: activeTab, }) } diff --git a/src/pages/recommend.vue b/src/pages/recommend.vue index c1927950..8238bf07 100644 --- a/src/pages/recommend.vue +++ b/src/pages/recommend.vue @@ -14,6 +14,9 @@ const { t } = useI18n() // 当前选择的分类 const currentCategory = ref(t('recommend.all')) +// 使用动态标签页 +const { registerHeaderTab } = useDynamicHeaderTab() + const viewList = reactive<{ apipath: string; linkurl: string; title: string; type: string }[]>([ { apipath: 'recommend/tmdb_trending', @@ -194,8 +197,22 @@ const categoryItems = computed(() => [ }, ]) -// 使用动态标签页 -const { registerHeaderTab } = useDynamicHeaderTab() +// 注册动态标签页 +registerHeaderTab({ + items: categoryItems, + modelValue: currentCategory, + appendButtons: [ + { + icon: 'mdi-tune', + variant: 'text', + color: 'grey', + class: 'settings-icon-button', + action: () => { + dialog.value = true + }, + }, + ], +}) onBeforeMount(async () => { await loadConfig() @@ -203,23 +220,6 @@ onBeforeMount(async () => { onMounted(async () => { await loadExtraRecommendSources() - - // 注册动态标签页 - registerHeaderTab({ - items: categoryItems, - modelValue: currentCategory, - appendButtons: [ - { - icon: 'mdi-tune', - variant: 'text', - color: 'grey', - class: 'settings-icon-button', - action: () => { - dialog.value = true - }, - }, - ], - }) }) onActivated(async () => { diff --git a/src/pages/setting.vue b/src/pages/setting.vue index 7030fb8d..0fce97f1 100644 --- a/src/pages/setting.vue +++ b/src/pages/setting.vue @@ -23,16 +23,18 @@ const settingTabs = computed(() => getSettingTabs()) // 使用动态标签页 const { registerHeaderTab } = useDynamicHeaderTab() +// 注册动态标签页 +registerHeaderTab({ + items: settingTabs.value, + modelValue: activeTab, +}) + // 注册动态标签页 onMounted(() => { // 设置初始activeTab值 if (!activeTab.value && settingTabs.value.length > 0) { activeTab.value = settingTabs.value[0].tab } - registerHeaderTab({ - items: settingTabs.value, - modelValue: activeTab, - }) }) diff --git a/src/pages/subscribe.vue b/src/pages/subscribe.vue index 36dbb868..9b176979 100644 --- a/src/pages/subscribe.vue +++ b/src/pages/subscribe.vue @@ -55,50 +55,52 @@ const searchActivator = computed(() => '[data-menu-activator="search-btn"]') // 使用动态标签页 const { registerHeaderTab } = useDynamicHeaderTab() +// 注册动态标签页 +registerHeaderTab({ + items: subscribeTabs.value, + modelValue: activeTab, + appendButtons: [ + { + icon: 'mdi-filter-multiple-outline', + variant: 'text', + color: computed(() => (subscribeFilter.value ? 'primary' : 'gray')), + class: 'settings-icon-button', + dataAttr: 'filter-btn', + action: () => { + filterSubscribeDialog.value = true + }, + show: computed(() => activeTab.value === 'mysub'), + }, + { + icon: 'mdi-movie-search-outline', + variant: 'text', + color: computed(() => (shareKeyword.value ? 'primary' : 'gray')), + class: 'settings-icon-button', + dataAttr: 'search-btn', + action: () => { + searchShareDialog.value = true + }, + show: computed(() => activeTab.value === 'share'), + }, + { + icon: 'mdi-clipboard-edit-outline', + variant: 'text', + color: 'gray', + class: 'settings-icon-button', + action: () => { + subscribeEditDialog.value = true + }, + show: computed(() => activeTab.value === 'mysub'), + }, + ], +}) + // 注册动态标签页 onMounted(() => { // 设置初始activeTab值 if (!activeTab.value && subscribeTabs.value.length > 0) { activeTab.value = subscribeTabs.value[0].tab } - registerHeaderTab({ - items: subscribeTabs.value, - modelValue: activeTab, - appendButtons: [ - { - icon: 'mdi-filter-multiple-outline', - variant: 'text', - color: computed(() => (subscribeFilter.value ? 'primary' : 'gray')), - class: 'settings-icon-button', - dataAttr: 'filter-btn', - action: () => { - filterSubscribeDialog.value = true - }, - show: computed(() => activeTab.value === 'mysub'), - }, - { - icon: 'mdi-movie-search-outline', - variant: 'text', - color: computed(() => (shareKeyword.value ? 'primary' : 'gray')), - class: 'settings-icon-button', - dataAttr: 'search-btn', - action: () => { - searchShareDialog.value = true - }, - show: computed(() => activeTab.value === 'share'), - }, - { - icon: 'mdi-clipboard-edit-outline', - variant: 'text', - color: 'gray', - class: 'settings-icon-button', - action: () => { - subscribeEditDialog.value = true - }, - show: computed(() => activeTab.value === 'mysub'), - }, - ], - }) })