Merge branch 'feature/20251001-gil' into feature/20250910-all

This commit is contained in:
clkim
2025-10-21 09:45:48 +09:00
9 changed files with 144 additions and 63 deletions

View File

@@ -10,12 +10,28 @@ interface Props {
}
const props = defineProps<Props>()
const {locale} = useI18n()
const { sendLog, useAnalyticsLogDataDirect } = useAnalytics()
const handleLinkClick = (title) => {
const trackingData = {
tracking: {
click_item: title,
action_type: 'click',
click_sarea: ''
}
}
sendLog(locale.value, useAnalyticsLogDataDirect(trackingData, 1))
}
</script>
<template>
<div
v-if="props.title || props.description"
:class="`card-news ${props.class || ''}`"
@click="handleLinkClick(props.title)"
>
<img
:src="props.imgPath"

View File

@@ -2,6 +2,7 @@
import { Splide } from '@splidejs/vue-splide'
import type { Splide as SplideType, ResponsiveOptions } from '@splidejs/splide'
import type { SlideItemSize } from '#layers/types/components/slide'
import { useSplideArrow } from '#layers/composables/useSplideArrow'
interface Props {
slideItemSize: SlideItemSize
@@ -20,6 +21,9 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits(['mounted', 'move', 'moved', 'arrowClick'])
// Splide 화살표 로직을 위한 composable 사용
const { addArrowClickListeners } = useSplideArrow()
const isMultipleItems = computed(() => {
return props.slideItemLength > 1
})
@@ -85,7 +89,9 @@ const handleSplideMounted = (splide: SplideType) => {
// 화살표 버튼 클릭 이벤트 리스너 추가
nextTick(() => {
addArrowClickListeners(splide)
addArrowClickListeners(splide, (direction, targetIndex) => {
emit('arrowClick', direction, targetIndex)
})
})
}
@@ -107,34 +113,6 @@ const handleMoved = (
emit('moved', splide, newIndex, oldIndex, destIndex)
}
const handleArrowClick = (direction: 'prev' | 'next', splide: SplideType) => {
const currentIndex = splide.index
const totalSlides = splide.length
// 이동할 슬라이드 인덱스 계산
let targetIndex: number
if (direction === 'next') {
targetIndex = currentIndex + 1 >= totalSlides ? 0 : currentIndex + 1
} else {
targetIndex = currentIndex - 1 < 0 ? totalSlides - 1 : currentIndex - 1
}
emit('arrowClick', direction, targetIndex)
}
// 화살표 버튼에 클릭 이벤트 리스너 추가
const addArrowClickListeners = (splide: SplideType) => {
const prevArrow = splide.root.querySelector('.arrow-prev')
const nextArrow = splide.root.querySelector('.arrow-next')
if (prevArrow) {
prevArrow.addEventListener('click', () => handleArrowClick('prev', splide))
}
if (nextArrow) {
nextArrow.addEventListener('click', () => handleArrowClick('next', splide))
}
}
</script>

View File

@@ -18,7 +18,10 @@ const props = withDefaults(defineProps<Props>(), {
pagination: true,
})
const emit = defineEmits(['mounted', 'move', 'moved'])
const emit = defineEmits(['mounted', 'move', 'moved', 'arrowClick'])
// Splide 화살표 로직을 위한 composable 사용
const { addArrowClickListeners } = useSplideArrow()
const isMultipleItems = computed(() => {
return props.slideItemLength > 1
@@ -85,6 +88,13 @@ const style = computed(() => {
const handleSplideMounted = (splide: SplideType) => {
emit('mounted', splide)
splide.refresh()
// 화살표 버튼 클릭 이벤트 리스너 추가
nextTick(() => {
addArrowClickListeners(splide, (direction, targetIndex) => {
emit('arrowClick', direction, targetIndex)
})
})
}
const handleMove = (

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Splide } from '@splidejs/vue-splide'
import type { Splide as SplideType, ResponsiveOptions } from '@splidejs/splide'
import { useSplideArrow } from '#layers/composables/useSplideArrow'
interface Props {
autoplay?: boolean | string
@@ -18,6 +19,8 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits(['mounted', 'move', 'moved', 'arrowClick'])
const splideRef = ref()
// Splide 화살표 로직을 위한 composable 사용
const { addArrowClickListeners } = useSplideArrow()
const options = computed((): ResponsiveOptions => {
return {
@@ -53,7 +56,9 @@ const handleSplideMounted = (splide: SplideType) => {
// 화살표 버튼 클릭 이벤트 리스너 추가
nextTick(() => {
addArrowClickListeners(splide)
addArrowClickListeners(splide, (direction, targetIndex) => {
emit('arrowClick', direction, targetIndex)
})
})
}
@@ -74,35 +79,6 @@ const handleMoved = (
) => {
emit('moved', splide, newIndex, oldIndex, destIndex)
}
const handleArrowClick = (direction: 'prev' | 'next', splide: SplideType) => {
const currentIndex = splide.index
const totalSlides = splide.length
// 이동할 슬라이드 인덱스 계산
let targetIndex: number
if (direction === 'next') {
targetIndex = currentIndex + 1 >= totalSlides ? 0 : currentIndex + 1
} else {
targetIndex = currentIndex - 1 < 0 ? totalSlides - 1 : currentIndex - 1
}
emit('arrowClick', direction, targetIndex)
}
// 화살표 버튼에 클릭 이벤트 리스너 추가
const addArrowClickListeners = (splide: SplideType) => {
const prevArrow = splide.root.querySelector('.arrow-prev')
const nextArrow = splide.root.querySelector('.arrow-next')
if (prevArrow) {
prevArrow.addEventListener('click', () => handleArrowClick('prev', splide))
}
if (nextArrow) {
nextArrow.addEventListener('click', () => handleArrowClick('next', splide))
}
}
</script>
<template>

View File

@@ -5,6 +5,7 @@ import type {
PageDataTemplateComponentSet,
PageDataResourceGroups,
} from '#layers/types/api/pageData'
import { useSplideArrow } from '#layers/composables/useSplideArrow'
interface Props {
slideData: PageDataTemplateComponentSet[]
@@ -18,6 +19,11 @@ const props = withDefaults(defineProps<Props>(), {
drag: true,
})
const emit = defineEmits(['arrowClick'])
// Splide 화살표 로직을 위한 composable 사용
const { addArrowClickListeners } = useSplideArrow()
let mainInst: SplideType | null = null
let thumbsInst: SplideType | null = null
@@ -85,6 +91,13 @@ onMounted(() => {
if (mainInst && thumbsInst) {
mainInst.sync(thumbsInst)
// 썸네일 슬라이드의 화살표 버튼에 이벤트 리스너 추가
nextTick(() => {
addArrowClickListeners(thumbsInst, (direction, targetIndex) => {
emit('arrowClick', direction, targetIndex)
})
})
}
})