fix: hide sports without hot leagues

This commit is contained in:
hajimi
2026-08-03 02:24:44 +08:00
parent 9ad49bad57
commit f53873c49b
@@ -33,7 +33,7 @@
<scroll-view v-if="activeTab === 'schedule'" scroll-x class="sport-tabs">
<view class="sport-tabs__inner">
<view v-for="(tab, idx) in sportTabs" :key="idx" class="sport-tab"
<view v-for="(tab, idx) in visibleSportTabs" :key="idx" class="sport-tab"
:class="{ 'sport-tab--active': currentSport === tab.value }" @tap="switchSport(tab.value)">
<text class="sport-tab__label">{{ tab.label }}</text>
</view>
@@ -425,6 +425,20 @@ const leagueTabs = computed(() => {
return leagues
})
const visibleSportTabs = computed(() => {
if (!hotLeagueMode.value) return sportTabs.value
const hotSportTypes = new Set<number>()
Object.keys(allLeagues.value).forEach((sportType) => {
const leagues = allLeagues.value[Number(sportType)] || []
if (leagues.some((league: any) => Number(league?.is_hot) === 1)) {
hotSportTypes.add(Number(sportType))
}
})
return sportTabs.value.filter((tab: any) => Number(tab?.value) === 0 || hotSportTypes.has(Number(tab?.value)))
})
const matchGroups = computed(() => {
const groups: { title: string; type: string; items: any[]; order: number }[] = []
const visibleLiveList = filterScheduleItems(liveList.value)