Texts.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <MainContentLayout id="texts">
  3. <template v-if="!content" v-slot:header>
  4. <span>Loading ...</span>
  5. </template>
  6. <template v-if="meta" v-slot:header>
  7. <h1>{{ meta.title }}</h1>
  8. </template>
  9. <section
  10. v-for="item in content"
  11. :key="item.uuid"
  12. >
  13. <h3 class="text-title">{{ item.title }}</h3>
  14. <div class="tei" v-html="item.tei" />
  15. </section>
  16. <template v-slot:nav />
  17. </MainContentLayout>
  18. </template>
  19. <script>
  20. import { REST } from 'api/rest-axios'
  21. import MainContentLayout from '../components/Layouts/MainContentLayout'
  22. export default {
  23. name: 'Texts',
  24. components: {
  25. MainContentLayout
  26. },
  27. data: () => ({
  28. content: null,
  29. meta: null
  30. }),
  31. beforeCreate () {
  32. console.log('texts this.$route', this.$route)
  33. REST.get(`/texts/` + this.$route.params.id, {})
  34. .then(({ data }) => {
  35. console.log('texts REST: data', data)
  36. this.meta = data.meta
  37. if (data.content) {
  38. if (Array.isArray(data.content)) {
  39. this.content = data.content
  40. } else {
  41. this.content = [data.content]
  42. }
  43. }
  44. })
  45. .catch((error) => {
  46. console.warn('Issue with locorum', error)
  47. Promise.reject(error)
  48. })
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. </style>