Pricing.vue 825 B

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