fix. GrGallery03 데이터 연결
This commit is contained in:
@@ -14,7 +14,7 @@ const splideRef = ref<SplideSlide | null>(null)
|
||||
const currentSlide = ref<number | null>(null)
|
||||
|
||||
const slideData = computed(() => {
|
||||
return getComponentContainer(props.components, 'group_sets')
|
||||
return getComponentContainer(props.components, 'group_sets', { maxLength: 5 })
|
||||
})
|
||||
|
||||
const goToSlide = (index: number) => {
|
||||
|
||||
@@ -23,7 +23,7 @@ const mainTitleData = computed(() =>
|
||||
const slideData = computed(() => {
|
||||
return ensureMinimumSlideData(props.components)
|
||||
})
|
||||
const subTitleData = ref(getComponentGroup(slideData?.value[0], 'subTitle'))
|
||||
const subTitleData = ref(getComponentGroup(slideData?.value[0], 'imgTitle'))
|
||||
const descriptionData = ref(
|
||||
getComponentGroup(slideData?.value[0], 'description')
|
||||
)
|
||||
@@ -50,7 +50,7 @@ const handleChange = (
|
||||
_oldIndex: number,
|
||||
_destIndex: number
|
||||
) => {
|
||||
subTitleData.value = getComponentGroup(slideData.value[newIndex], 'subTitle')
|
||||
subTitleData.value = getComponentGroup(slideData.value[newIndex], 'imgTitle')
|
||||
descriptionData.value = getComponentGroup(
|
||||
slideData.value[newIndex],
|
||||
'description'
|
||||
@@ -84,7 +84,7 @@ const handleChange = (
|
||||
<BlocksVisualContent
|
||||
:resources-data="getComponentGroup(item, 'imgList')"
|
||||
object-fit="cover"
|
||||
:alt="getComponentGroup(item, 'subTitle')?.display?.text"
|
||||
:alt="getComponentGroup(item, 'imgTitle')?.display?.text"
|
||||
/>
|
||||
</div>
|
||||
</SplideSlide>
|
||||
|
||||
@@ -68,15 +68,18 @@ export const isTypeButton = (type: PageDataResourceGroupType): boolean => {
|
||||
* 컴포넌트 컨테이너를 반환합니다.
|
||||
* @param components props.components
|
||||
* @param componentName 컴포넌트 이름
|
||||
* @param options 옵션 (maxLength: 최대 길이)
|
||||
* @returns 컴포넌트 컨테이너
|
||||
*/
|
||||
export const getComponentContainer = (
|
||||
components: PageDataTemplateComponents | OperateComponents,
|
||||
componentName: string
|
||||
componentName: string,
|
||||
{ maxLength }: { maxLength?: number } = {}
|
||||
) => {
|
||||
if (!components) return []
|
||||
|
||||
return components[componentName] || []
|
||||
const container = components[componentName] || []
|
||||
return maxLength ? container.slice(0, maxLength) : container
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user