Showrooms.vue 805 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div id="showrooms">
  3. <div class="loading" v-if="!items.length">
  4. <span>Loading ...</span>
  5. </div>
  6. <Showroom
  7. v-else
  8. v-for="item in items"
  9. v-bind:key="item.uuid"
  10. :item="item"
  11. />
  12. </div>
  13. </template>
  14. <script>
  15. import Showroom from 'vuejs/components/Content/Showroom'
  16. import { mapState, mapActions } from 'vuex'
  17. export default {
  18. name: "Showrooms",
  19. // data() {
  20. // return {
  21. // items:[],
  22. // page:0
  23. // }
  24. // },
  25. computed: {
  26. ...mapState({
  27. items: state => state.Showrooms.items
  28. })
  29. },
  30. created(){
  31. if(!this.items.length)
  32. this.getItems()
  33. },
  34. methods: {
  35. ...mapActions({
  36. getItems: 'Showrooms/getItems'
  37. })
  38. },
  39. components: {
  40. Showroom
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. </style>