index.vue 656 B

1234567891011121314151617181920212223242526272829303132
  1. <template>
  2. <div class="w-full overflow-y-scroll flex flex-col p-2 gap-5">
  3. <div
  4. v-if="!newsList"
  5. class="w-full h-full flex items-center justify-center"
  6. >
  7. <ILoader
  8. class="w-16 h-16"
  9. />
  10. </div>
  11. <template v-else>
  12. <WallPost
  13. v-for="news in newsList"
  14. :key="news.id"
  15. :image="news.preview"
  16. :title="news.title"
  17. :description="news.description"
  18. :date="news.date"
  19. />
  20. </template>
  21. </div>
  22. </template>
  23. <script setup lang="ts">
  24. const api = useApi()
  25. const newsList = ref(null)
  26. onMounted(async () => {
  27. newsList.value = await api.get('/news/')
  28. })
  29. </script>