Operum.vue 2.2 KB

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