fix. Splide 최적화

This commit is contained in:
clkim
2025-12-18 14:32:40 +09:00
parent 78ce718f72
commit 6d93bebd8b
5 changed files with 17 additions and 16 deletions

View File

@@ -3,11 +3,13 @@ interface Props {
src: string | { pc?: string; mo?: string }
alt?: string
imageType?: 'common' | 'game'
priority?: 'high' | 'low' | 'auto'
}
const props = withDefaults(defineProps<Props>(), {
alt: 'image',
imageType: 'game',
priority: 'auto',
})
const isResponsiveMode = computed(() => {
@@ -45,9 +47,9 @@ const imagePaths = computed(() => {
:src="imagePaths.pc"
:alt="alt"
v-bind="$attrs"
loading="lazy"
:loading="priority === 'high' ? 'eager' : 'lazy'"
decoding="async"
fetchpriority="auto"
:fetchpriority="priority"
/>
</picture>
@@ -56,8 +58,8 @@ const imagePaths = computed(() => {
:src="imagePaths.mo"
:alt="alt"
v-bind="$attrs"
loading="lazy"
:loading="priority === 'high' ? 'eager' : 'lazy'"
decoding="async"
fetchpriority="auto"
:fetchpriority="priority"
/>
</template>

View File

@@ -45,6 +45,7 @@ const options = computed((): ResponsiveOptions => {
arrows: props.arrows,
pagination: props.pagination,
flickPower: 300,
lazyLoad: 'nearby',
classes: {
pagination: 'splide-pagination-bullets type-full',
page: 'splide-pagination-bullet',

View File

@@ -51,6 +51,8 @@ const mainOptions = computed<Options>(() => ({
arrows: false,
pagination: false,
drag: props.drag,
updateOnMove: true,
lazyLoad: 'nearby', // 성능 최적화: 이미지 지연 로딩
}))
const thumbOptions = computed<Options>(() => ({

View File

@@ -75,12 +75,11 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
query: queryParams,
})) as PageDataResponse | null
console.log('🚀 ~ pageData.global response:', pageDataResponse?.value)
console.log('🚀 ~ pageData.global response:', pageDataResponse)
} catch (error) {
pageDataStore.clearPageData()
console.error(error)
showError(
return showError(
createError({
statusCode: error.statusCode,
statusMessage: error.message,
@@ -92,8 +91,8 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
if (pageDataResponse?.code === 0 && 'value' in pageDataResponse) {
pageDataStore.setPageData(pageDataResponse.value)
return
} else {
pageDataStore.clearPageData()
// 90001 (API Respond 4xx status): API 응답 4xx 에러
// 91001 (Invalid GameCode): 게임 코드 없음
// 91003 (Invalid PageUrl): 페이지 주소 없음
@@ -102,20 +101,20 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
pageDataResponse?.code === 91001 ||
pageDataResponse?.code === 91003
) {
showError(
return showError(
createError({
statusCode: 404,
statusMessage: pageDataResponse?.message,
fatal: false, // 즉시 에러 페이지로
data: { reason: pageDataResponse?.message },
data: {
reason: pageDataResponse?.message,
},
})
)
return
}
// 91002 (Invalid LangCode): 미지원 언어로 접근
if (pageDataResponse?.code === 91002) {
navigateTo(`/${langCode}/home`)
return
return navigateTo(`/${langCode}/home`)
}
// [TODO]
@@ -124,6 +123,4 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
// return navigateTo(`/${langCode}/home`)
// }
}
pageDataStore.clearPageData()
})

View File

@@ -59,7 +59,6 @@ export default defineNuxtConfig({
{
type: 'text/javascript',
src: process.env.STOVE_LAUNCHER_SCRIPT,
async: true,
defer: true,
},
],