fix. gnb 수정

This commit is contained in:
clkim
2025-12-09 12:46:22 +09:00
parent 50b0ab76e7
commit 517135bb49
2 changed files with 18 additions and 17 deletions

View File

@@ -15,7 +15,7 @@ const PLATFORM_LABEL_KEY: Record<PlatformTransformType, string> = {
pc: 'PC',
google_play: 'Google Play',
app_store: 'App Store',
}
} as const
const route = useRoute()
const { tm } = useI18n()
@@ -40,7 +40,7 @@ const isMounted = ref(false)
const isMenuOpen = ref(false)
const navWidth = ref(0)
const officialItemWidths = ref<number[]>([])
const overflowNam = ref<number>(0)
const overflowCount = ref<number>(0)
const gnbData = computed(() => gameData.value?.gnb)
const hasGnbMenus = computed(() => {
@@ -107,7 +107,7 @@ const calculateOverflow = () => {
if (!navAreaRef.value || !startRef.value) return
if (breakpoints.value.isMobile) {
overflowNam.value = 0
overflowCount.value = 0
return
}
@@ -128,16 +128,14 @@ const calculateOverflow = () => {
}
}
overflowNam.value = removedCount
overflowCount.value = removedCount
} else {
overflowNam.value = 0
overflowCount.value = 0
}
}
// 100ms마다 최대 1회 실행
const throttledCalculateOverflow = useThrottleFn(() => {
calculateOverflow()
}, 100)
const throttledCalculateOverflow = useThrottleFn(calculateOverflow, 100)
const handleMenuOpen = () => {
isMenuOpen.value = true
@@ -195,7 +193,8 @@ const handleStartClick = () => {
: null
if (!target || !supportedPlatforms.value.includes(target)) {
return showNotSupportedOSAlert()
showNotSupportedOSAlert()
return
}
const url = gameData.value?.market_json?.[target]?.url || ''
@@ -205,7 +204,7 @@ const handleStartClick = () => {
}
onMounted(() => {
overflowNam.value = 0
overflowCount.value = 0
isMounted.value = true
// 초기 계산
@@ -269,9 +268,9 @@ onMounted(() => {
:class="{
'is-hidden':
breakpoints.isDesktop &&
overflowNam > 0 &&
overflowCount > 0 &&
Number(key) >=
Object.keys(gnbData?.menus).length - overflowNam,
Object.keys(gnbData?.menus).length - overflowCount,
}"
>
<component
@@ -326,7 +325,7 @@ onMounted(() => {
</Transition>
</div>
</div>
<div v-if="overflowNam > 0" class="more group">
<div v-if="overflowCount > 0" class="more group">
<button class="btn-more">
<AtomsIconsOptionHorizontalFill class="mx-auto" />
<span class="sr-only">more</span>
@@ -337,9 +336,11 @@ onMounted(() => {
v-for="(gnbItem, key) in gnbData?.menus"
:key="key"
:class="{
hidden:
Number(key) <
Object.keys(gnbData?.menus).length - overflowNam,
'is-hidden':
breakpoints.isDesktop &&
overflowCount > 0 &&
Number(key) >=
Object.keys(gnbData?.menus).length - overflowCount,
}"
>
<component