Corpus.vue 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <MainContentLayout id="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.url">
  9. <CorpusItem :item="item" />
  10. </li>
  11. </ul>
  12. <template v-slot:nav>
  13. </template>
  14. </MainContentLayout>
  15. </template>
  16. <script>
  17. import CorpusItem from '../components/Content/CorpusItem'
  18. import MainContentLayout from '../components/Layouts/MainContentLayout'
  19. import { mapState, mapActions } from 'vuex'
  20. export default {
  21. name: 'Corpus',
  22. components: {
  23. CorpusItem,
  24. MainContentLayout
  25. },
  26. data: () => ({
  27. // items: []
  28. }),
  29. computed: {
  30. ...mapState({
  31. items: state => state.Corpus.items
  32. })
  33. },
  34. created () {
  35. if (!this.items.length) {
  36. this.getItems()
  37. }
  38. },
  39. methods: {
  40. ...mapActions({
  41. getItems: 'Corpus/getItems'
  42. })
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. </style>