Corpus.vue 838 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <div
  3. id="corpus"
  4. class="full-width"
  5. >
  6. <h1>Corpus</h1>
  7. <span v-if="!items.length">Loading ...</span>
  8. <div v-else class="item-list">
  9. <ul>
  10. <li v-for="item in items" :key="item.url">
  11. <CorpusItem :item="item" />
  12. </li>
  13. </ul>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. import CorpusItem from '../components/Content/CorpusItem'
  19. import { mapState, mapActions } from 'vuex'
  20. export default {
  21. name: 'Corpus',
  22. components: {
  23. CorpusItem
  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>