Corpus.vue 1016 B

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