mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-07 04:52:45 +08:00
优化动态标签页注册逻辑
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -41,7 +41,7 @@ async function loadDownloaderSetting() {
|
||||
const registerTabs = () => {
|
||||
if (downloaderItems.value.length > 0) {
|
||||
registerHeaderTab({
|
||||
items: downloaderItems.value,
|
||||
items: downloaderItems,
|
||||
modelValue: activeTab,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -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'),
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user