ListCorpus.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. components: {
  51. // CorpusItem,
  52. MainContentLayout
  53. },
  54. data: () => ({
  55. // editionslist: []
  56. }),
  57. computed: {
  58. ...mapState({
  59. editionslist: state => state.Corpus.editionslist
  60. })
  61. },
  62. created () {
  63. if (!this.editionslist.length) {
  64. this.getCorpuses()
  65. }
  66. },
  67. methods: {
  68. ...mapActions({
  69. getCorpuses: 'Corpus/getCorpuses'
  70. }),
  71. onclick (e) {
  72. console.log('clicked on editon', e)
  73. this.$router.push({
  74. name: `edition`,
  75. params: { id: e.target.getAttribute('uuid') }
  76. })
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. </style>