Locorum.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <MainContentLayout id="locorum" class="index-item">
  3. <template v-if="!content" v-slot:header>
  4. <span class="loading">Loading ...</span>
  5. </template>
  6. <template v-if="content" v-slot:header>
  7. <h1 v-html="content.title" />
  8. <p>{{ content.country }}</p>
  9. <p>{{ content.ville }}</p>
  10. <p>{{ content.type }}</p>
  11. <section class="notes">
  12. <div v-for="(note, i) in content.note" :key="i" class="note" v-html="note" />
  13. </section>
  14. <section v-if="content.autorities.length" class="autorities">
  15. <h3>Autorities</h3>
  16. <ul>
  17. <li v-for="(aut, i) in content.autorities" :key="i">
  18. <a :href="aut.identifier" target="_blanck">
  19. {{ aut.autority }}
  20. <span class="mdi mdi-open-in-new" />
  21. </a>
  22. </li>
  23. </ul>
  24. </section>
  25. </template>
  26. <!-- default slot -->
  27. <IndexItemOcurrences v-if="content" :content="content" />
  28. </MainContentLayout>
  29. </template>
  30. <script>
  31. import { REST } from 'api/rest-axios'
  32. import MainContentLayout from '../components/Layouts/MainContentLayout'
  33. import IndexItemOcurrences from '../components/Content/IndexItemOcurrences'
  34. export default {
  35. name: 'Locorum',
  36. components: {
  37. MainContentLayout,
  38. IndexItemOcurrences
  39. },
  40. data: () => ({
  41. content: null
  42. }),
  43. metaInfo () {
  44. return {
  45. title: `Locorum ${this.$route.params.id}`
  46. }
  47. },
  48. computed: {
  49. },
  50. beforeCreate () {
  51. console.log('locorum this.$route', this.$route)
  52. REST.get(`${window.apipath}/indexLocorum/` + this.$route.params.id, {})
  53. .then(({ data }) => {
  54. console.log('locorum REST: data', data)
  55. if (data.content) {
  56. this.content = data.content
  57. }
  58. })
  59. .catch((error) => {
  60. console.warn('Issue with locorum', error)
  61. Promise.reject(error)
  62. this.$router.replace({
  63. name: 'notfound',
  64. query: { fullpath: this.$route.path }
  65. })
  66. })
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. </style>