ListCorpus.vue 1002 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <MainContentLayout id="list-corpus">
  3. <template v-slot:header>
  4. <h1>Corpus</h1>
  5. <span v-if="!items.length">Loading ...</span>
  6. </template>
  7. <ul v-if="items.length" class="item-list">
  8. <li v-for="item in items" :key="item.uuid">
  9. <CorpusItem :item="item" />
  10. </li>
  11. </ul>
  12. <template v-slot:nav />
  13. </MainContentLayout>
  14. </template>
  15. <script>
  16. import CorpusItem from '../components/Content/CorpusItem'
  17. import MainContentLayout from '../components/Layouts/MainContentLayout'
  18. import { mapState, mapActions } from 'vuex'
  19. export default {
  20. name: 'ListCorpus',
  21. components: {
  22. CorpusItem,
  23. MainContentLayout
  24. },
  25. data: () => ({
  26. // items: []
  27. }),
  28. computed: {
  29. ...mapState({
  30. items: state => state.Corpus.items
  31. })
  32. },
  33. created () {
  34. if (!this.items.length) {
  35. this.getItems()
  36. }
  37. },
  38. methods: {
  39. ...mapActions({
  40. getItems: 'Corpus/getItems'
  41. })
  42. }
  43. }
  44. </script>
  45. <style lang="scss" scoped>
  46. </style>