ListCorpus.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. <h2>{{ corpus.meta.author }}</h2>
  10. <ul>
  11. <li v-for="text in corpus.content" :key="text.uuid">
  12. <h3>
  13. <a
  14. :href="text.url"
  15. :uuid="text.uuid"
  16. @click.prevent="onclick"
  17. @keyup.enter="onclick"
  18. v-html="text.title"
  19. />
  20. </h3>
  21. </li>
  22. </ul>
  23. <!-- <CorpusItem :item="item" /> -->
  24. </li>
  25. </ul>
  26. <template v-slot:nav />
  27. </MainContentLayout>
  28. </template>
  29. <script>
  30. // import CorpusItem from '../components/Content/CorpusItem'
  31. import MainContentLayout from '../components/Layouts/MainContentLayout'
  32. import { mapState, mapActions } from 'vuex'
  33. export default {
  34. name: 'ListCorpus',
  35. components: {
  36. // CorpusItem,
  37. MainContentLayout
  38. },
  39. data: () => ({
  40. // editionslist: []
  41. }),
  42. computed: {
  43. ...mapState({
  44. editionslist: state => state.Corpus.editionslist
  45. })
  46. },
  47. created () {
  48. if (!this.editionslist.length) {
  49. this.getCorpuses()
  50. }
  51. },
  52. methods: {
  53. ...mapActions({
  54. getCorpuses: 'Corpus/getCorpuses'
  55. }),
  56. onclick (e) {
  57. console.log('clicked on editon', e)
  58. this.$router.push({
  59. name: `editiontoc`,
  60. params: { id: e.target.getAttribute('uuid') }
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. </style>