Locorum.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <MainContentLayout id="locorum" class="index">
  3. <template v-slot:header>
  4. <h1>Lieux</h1>
  5. <span v-if="!items.length">Loading ...</span>
  6. </template>
  7. <ul v-if="items.length" class="item-list">
  8. <li v-for="item in items" :key="item.url">
  9. <LocorumItem :item="item" />
  10. </li>
  11. </ul>
  12. <template v-slot:nav>
  13. </template>
  14. </MainContentLayout>
  15. </template>
  16. <script>
  17. import { REST } from 'api/rest-axios'
  18. import MainContentLayout from '../components/Layouts/MainContentLayout'
  19. import LocorumItem from '../components/Content/LocorumItem'
  20. export default {
  21. name: 'Locorum',
  22. components: {
  23. LocorumItem,
  24. MainContentLayout
  25. },
  26. data: () => ({
  27. items: []
  28. }),
  29. beforeCreate () {
  30. REST.get(`/indexLocorum`, {})
  31. .then(({ data }) => {
  32. console.log('locorum REST: data', data)
  33. if (data.content.length) {
  34. this.items = data.content
  35. }
  36. })
  37. .catch((error) => {
  38. console.warn('Issue with locorum', error)
  39. Promise.reject(error)
  40. })
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. </style>