mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
优化动态标签页注册逻辑
This commit is contained in:
+16
-15
@@ -123,20 +123,8 @@ async function saveTabOrder() {
|
|||||||
// 使用动态标签页
|
// 使用动态标签页
|
||||||
const { registerHeaderTab } = useDynamicHeaderTab()
|
const { registerHeaderTab } = useDynamicHeaderTab()
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
// 注册动态标签页
|
||||||
initDiscoverTabs()
|
registerHeaderTab({
|
||||||
await loadOrderConfig()
|
|
||||||
await loadExtraDiscoverSources()
|
|
||||||
sortSubscribeOrder()
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// 选中第一个标签页
|
|
||||||
if (discoverTabs.value.length > 0) {
|
|
||||||
activeTab.value = discoverTabs.value[0].mediaid_prefix
|
|
||||||
}
|
|
||||||
// 注册动态标签页
|
|
||||||
registerHeaderTab({
|
|
||||||
items: discoverTabItems, // 传递computed值,而不是.value
|
items: discoverTabItems, // 传递computed值,而不是.value
|
||||||
modelValue: activeTab,
|
modelValue: activeTab,
|
||||||
appendButtons: [
|
appendButtons: [
|
||||||
@@ -150,7 +138,20 @@ onMounted(() => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
initDiscoverTabs()
|
||||||
|
await loadOrderConfig()
|
||||||
|
await loadExtraDiscoverSources()
|
||||||
|
sortSubscribeOrder()
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 选中第一个标签页
|
||||||
|
if (discoverTabs.value.length > 0) {
|
||||||
|
activeTab.value = discoverTabs.value[0].mediaid_prefix
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onActivated(async () => {
|
onActivated(async () => {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ async function loadDownloaderSetting() {
|
|||||||
const registerTabs = () => {
|
const registerTabs = () => {
|
||||||
if (downloaderItems.value.length > 0) {
|
if (downloaderItems.value.length > 0) {
|
||||||
registerHeaderTab({
|
registerHeaderTab({
|
||||||
items: downloaderItems.value,
|
items: downloaderItems,
|
||||||
modelValue: activeTab,
|
modelValue: activeTab,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -14,6 +14,9 @@ const { t } = useI18n()
|
|||||||
// 当前选择的分类
|
// 当前选择的分类
|
||||||
const currentCategory = ref(t('recommend.all'))
|
const currentCategory = ref(t('recommend.all'))
|
||||||
|
|
||||||
|
// 使用动态标签页
|
||||||
|
const { registerHeaderTab } = useDynamicHeaderTab()
|
||||||
|
|
||||||
const viewList = reactive<{ apipath: string; linkurl: string; title: string; type: string }[]>([
|
const viewList = reactive<{ apipath: string; linkurl: string; title: string; type: string }[]>([
|
||||||
{
|
{
|
||||||
apipath: 'recommend/tmdb_trending',
|
apipath: 'recommend/tmdb_trending',
|
||||||
@@ -194,18 +197,8 @@ const categoryItems = computed(() => [
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 使用动态标签页
|
// 注册动态标签页
|
||||||
const { registerHeaderTab } = useDynamicHeaderTab()
|
registerHeaderTab({
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
|
||||||
await loadConfig()
|
|
||||||
})
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await loadExtraRecommendSources()
|
|
||||||
|
|
||||||
// 注册动态标签页
|
|
||||||
registerHeaderTab({
|
|
||||||
items: categoryItems,
|
items: categoryItems,
|
||||||
modelValue: currentCategory,
|
modelValue: currentCategory,
|
||||||
appendButtons: [
|
appendButtons: [
|
||||||
@@ -219,7 +212,14 @@ onMounted(async () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
await loadConfig()
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await loadExtraRecommendSources()
|
||||||
})
|
})
|
||||||
|
|
||||||
onActivated(async () => {
|
onActivated(async () => {
|
||||||
|
|||||||
@@ -23,16 +23,18 @@ const settingTabs = computed(() => getSettingTabs())
|
|||||||
// 使用动态标签页
|
// 使用动态标签页
|
||||||
const { registerHeaderTab } = useDynamicHeaderTab()
|
const { registerHeaderTab } = useDynamicHeaderTab()
|
||||||
|
|
||||||
|
// 注册动态标签页
|
||||||
|
registerHeaderTab({
|
||||||
|
items: settingTabs.value,
|
||||||
|
modelValue: activeTab,
|
||||||
|
})
|
||||||
|
|
||||||
// 注册动态标签页
|
// 注册动态标签页
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 设置初始activeTab值
|
// 设置初始activeTab值
|
||||||
if (!activeTab.value && settingTabs.value.length > 0) {
|
if (!activeTab.value && settingTabs.value.length > 0) {
|
||||||
activeTab.value = settingTabs.value[0].tab
|
activeTab.value = settingTabs.value[0].tab
|
||||||
}
|
}
|
||||||
registerHeaderTab({
|
|
||||||
items: settingTabs.value,
|
|
||||||
modelValue: activeTab,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,7 @@ const searchActivator = computed(() => '[data-menu-activator="search-btn"]')
|
|||||||
const { registerHeaderTab } = useDynamicHeaderTab()
|
const { registerHeaderTab } = useDynamicHeaderTab()
|
||||||
|
|
||||||
// 注册动态标签页
|
// 注册动态标签页
|
||||||
onMounted(() => {
|
registerHeaderTab({
|
||||||
// 设置初始activeTab值
|
|
||||||
if (!activeTab.value && subscribeTabs.value.length > 0) {
|
|
||||||
activeTab.value = subscribeTabs.value[0].tab
|
|
||||||
}
|
|
||||||
registerHeaderTab({
|
|
||||||
items: subscribeTabs.value,
|
items: subscribeTabs.value,
|
||||||
modelValue: activeTab,
|
modelValue: activeTab,
|
||||||
appendButtons: [
|
appendButtons: [
|
||||||
@@ -98,7 +93,14 @@ onMounted(() => {
|
|||||||
show: computed(() => activeTab.value === 'mysub'),
|
show: computed(() => activeTab.value === 'mysub'),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 注册动态标签页
|
||||||
|
onMounted(() => {
|
||||||
|
// 设置初始activeTab值
|
||||||
|
if (!activeTab.value && subscribeTabs.value.length > 0) {
|
||||||
|
activeTab.value = subscribeTabs.value[0].tab
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user