fix. 코드 리팩토링
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
getComponentGroup,
|
||||
hasComponentGroup,
|
||||
} from '#layers/utils/dataUtil'
|
||||
import { getResponsiveSrc } from '#layers/utils/styleUtil'
|
||||
import type { Splide as SplideType } from '@splidejs/splide'
|
||||
import type {
|
||||
PageDataTemplateComponents,
|
||||
@@ -20,7 +19,7 @@ interface Props {
|
||||
|
||||
const props = defineProps<Props>()
|
||||
|
||||
const breakpoints = useResponsiveBreakpointsReliable()
|
||||
const { getCurrentSrc } = useResponsiveSrc()
|
||||
|
||||
const currentSlideIndex = ref<number>(0)
|
||||
|
||||
@@ -33,15 +32,9 @@ const paginationData = computed(() => {
|
||||
return getComponentGroupAry(props.components, 'pagination')
|
||||
})
|
||||
|
||||
const currentVideoSrc = (item: PageDataTemplateComponent) => {
|
||||
const videoSrc = getComponentGroup(item, 'video')?.res_path
|
||||
const responsiveSrc = getResponsiveSrc(videoSrc, {
|
||||
resourcesType: 'video',
|
||||
})
|
||||
|
||||
return breakpoints.value.isMobile
|
||||
? responsiveSrc.mobileSrc
|
||||
: responsiveSrc.pcSrc
|
||||
const videoSrc = (item: PageDataTemplateComponent) => {
|
||||
const src = getComponentGroup(item, 'video')?.res_path
|
||||
return getCurrentSrc(src, { resourcesType: 'video' })
|
||||
}
|
||||
|
||||
const handleSplideMove = (_splide: SplideType, newIndex: number) => {
|
||||
@@ -66,7 +59,9 @@ const handleSplideMove = (_splide: SplideType, newIndex: number) => {
|
||||
size="contain"
|
||||
:resources-data="getComponentGroup(item, 'foreground')"
|
||||
/>
|
||||
<div class="section-content max-w-[1024px] mx-auto items-start">
|
||||
<div
|
||||
class="section-content max-w-[1024px] mx-auto items-start pt-[48px] md:pt-0"
|
||||
>
|
||||
<WidgetsSubTitle
|
||||
v-if="hasComponentGroup(item, 'category')"
|
||||
:resources-data="getComponentGroup(item, 'category')"
|
||||
@@ -90,11 +85,13 @@ const handleSplideMove = (_splide: SplideType, newIndex: number) => {
|
||||
/>
|
||||
<AtomsVideo
|
||||
v-if="hasComponentGroup(item, 'video')"
|
||||
:src="currentVideoSrc(item)"
|
||||
:autoplay="currentSlideIndex === index"
|
||||
:src="videoSrc(item)"
|
||||
:play="currentSlideIndex === index"
|
||||
autoplay
|
||||
muted
|
||||
loop
|
||||
playsinline
|
||||
class="aspect-[16/10] w-[258px] mt-8 md:w-[496px] md:mt-10"
|
||||
/>
|
||||
</div>
|
||||
</SplideSlide>
|
||||
|
||||
Reference in New Issue
Block a user