ff-webpage/components/shared/List.vue

28 lines
789 B
Vue
Raw Normal View History

<template>
2024-11-03 14:34:48 +00:00
<div v-for="item in collection" :key="item.slug" class="contents">
<BaseListImageItem v-if="data?.lookup.imageItem" :data="item" />
<BaseListItem v-else :data="item" />
</div>
</template>
<script setup lang="ts">
import type { PropType } from "vue";
import type SharedList from "../../types/component/sharedList";
2024-11-03 14:34:48 +00:00
import type BaseCollection from "~/types/collection/baseCollection";
2024-11-03 14:34:48 +00:00
const { find } = useStrapi();
const props = defineProps({
data: Object as PropType<SharedList>,
});
2024-11-03 14:34:48 +00:00
const { data: collections } = await useAsyncData("collection", () =>
find<BaseCollection>(props.data?.lookup.collection ?? "", {
populate: {
populate: "*",
},
})
);
const collection = ref<Array<BaseCollection> | undefined>(collections.value?.data);
</script>