ListCorpus.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <MainContentLayout id="list-corpus">
  3. <template v-slot:header>
  4. <h1>Corpus</h1>
  5. <span v-if="!editionslist.length">Loading ...</span>
  6. </template>
  7. <ul v-if="editionslist.length" class="item-list">
  8. <li v-for="(corpus,index) in editionslist" :key="index">
  9. <header>
  10. <h2>{{ corpus.author.title }}</h2>
  11. <h3>{{ corpus.author.date }}</h3>
  12. </header>
  13. <section class="editions">
  14. <h4 class="editions-quantity">
  15. {{ corpus.author.editionsQuantity.quantity }} {{ corpus.author.editionsQuantity.unit }}
  16. </h4>
  17. <!-- <div v-if="corpus.author.editions" class="editions" v-html="corpus.author.editions"/> -->
  18. </section>
  19. <section class="texts">
  20. <h4 class="texts-quantity">
  21. {{ corpus.author.textsQuantity.quantity }}
  22. {{ corpus.author.textsQuantity.unit }}
  23. </h4>
  24. <ul class="texts-list">
  25. <li v-for="text in corpus.editions.content" :key="text.uuid">
  26. <h3>
  27. <a
  28. :href="text.url"
  29. :uuid="text.uuid"
  30. @click.prevent="onclick"
  31. @keyup.enter="onclick"
  32. v-html="text.title"
  33. />
  34. </h3>
  35. </li>
  36. </ul>
  37. </section>
  38. <!-- <CorpusItem :item="item" /> -->
  39. </li>
  40. </ul>
  41. <template v-slot:nav />
  42. </MainContentLayout>
  43. </template>
  44. <script>
  45. // import CorpusItem from '../components/Content/CorpusItem'
  46. import MainContentLayout from '../components/Layouts/MainContentLayout'
  47. import { mapState, mapActions } from 'vuex'
  48. export default {
  49. name: 'ListCorpus',
  50. metaInfo: {
  51. title: 'Corpus'
  52. },
  53. components: {
  54. // CorpusItem,
  55. MainContentLayout
  56. },
  57. data: () => ({
  58. // editionslist: []
  59. }),
  60. computed: {
  61. ...mapState({
  62. editionslist: state => state.Corpus.editionslist
  63. })
  64. },
  65. created () {
  66. if (!this.editionslist.length) {
  67. this.getCorpuses()
  68. }
  69. },
  70. methods: {
  71. ...mapActions({
  72. getCorpuses: 'Corpus/getCorpuses'
  73. }),
  74. onclick (e) {
  75. console.log('clicked on editon', e)
  76. this.$router.push({
  77. name: `edition`,
  78. params: { id: e.target.getAttribute('uuid') }
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. </style>