IndexItemOcurrences.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div>
  3. <div class="tabs">
  4. <span
  5. v-if="content.occurences"
  6. class="tab"
  7. :class="{ active: tab === 'occurences' }"
  8. @click.prevent="onclickTab('occurences')"
  9. @keyup.enter="onclickTab('occurences')"
  10. >Occurences</span>
  11. <span
  12. v-if="content.attestedForms"
  13. class="tab"
  14. :class="{ active: tab === 'formes' }"
  15. @click.prevent="onclickTab('formes')"
  16. @keyup.enter="onclickTab('formes')"
  17. >Formes attestées</span>
  18. </div>
  19. <section v-if="content.occurences" v-show="tab === 'occurences'" class="occurences">
  20. <ul>
  21. <li
  22. v-for="ed in content.occurences"
  23. :key="ed.item"
  24. >
  25. <h3>
  26. <a
  27. :href="'/texts/'+ed.item"
  28. :uuid="ed.item"
  29. v-html="ed.biblio"
  30. />
  31. </h3>
  32. <ul>
  33. <li
  34. v-for="oc in ocAsArray(ed.occurences)"
  35. :key="oc.id"
  36. >
  37. <!-- <li
  38. v-for="oc in ed.occurences"
  39. :key="oc.uuid"
  40. > -->
  41. <occurence v-if="oc.title" :ed="ed" :oc="oc" />
  42. </li>
  43. </ul>
  44. </li>
  45. </ul>
  46. </section>
  47. <section v-if="content.attestedForms" v-show="tab === 'formes'" class="attested-forms-occurences">
  48. <!-- <h3>Attested forms</h3> -->
  49. <ul>
  50. <li v-for="(af, i) in content.attestedForms" :key="i">
  51. <h3 class="form">{{ af.title }}</h3>
  52. <ul>
  53. <li v-for="(oc, j) in af.occurences" :key="j">
  54. <forme :form="af.title" :oc="oc" />
  55. </li>
  56. </ul>
  57. </li>
  58. </ul>
  59. </section>
  60. </div>
  61. </template>
  62. <script>
  63. import Occurence from './Occurence'
  64. import Forme from './Forme'
  65. export default {
  66. name: 'IndexItemOcurrences',
  67. components: {
  68. Occurence,
  69. Forme
  70. },
  71. props: {
  72. content: Object
  73. },
  74. data: () => ({
  75. tab: 'occurences'
  76. }),
  77. methods: {
  78. ocAsArray (oc) {
  79. // not necesseary anymore (KB #758)
  80. console.log('Array.isArray(oc)', Array.isArray(oc))
  81. return Array.isArray(oc) ? oc : [oc]
  82. },
  83. onclickTab (tab) {
  84. this.tab = tab
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. </style>