RecipesList.vue 707 B

1234567891011121314151617181920212223242526
  1. <script setup lang="ts">
  2. const { data } = await useAsyncData(() => queryCollection('docs').where('path', 'LIKE', '/cookbook/%').where('extension', '=', 'md').all())
  3. const recipes = computed(() => Array.from(data.value || []))
  4. </script>
  5. <template>
  6. <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
  7. <UPageCard
  8. v-for="recipe in recipes"
  9. :key="recipe.id"
  10. :title="recipe.title"
  11. :description="recipe.description"
  12. :to="recipe.path"
  13. reverse
  14. spotlight
  15. >
  16. <img
  17. v-if="recipe.meta"
  18. :src="recipe.meta.thumbnail as string"
  19. alt="recipe thumbnail"
  20. class="w-full h-full object-cover"
  21. />
  22. </UPageCard>
  23. </div>
  24. </template>