CartList.vue 701 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template lang="pug">
  2. .cart-list
  3. template(v-for="item in items")
  4. cart-item(:data="item")
  5. </template>
  6. <script>
  7. import CartItem from '@/components/CartItem'
  8. import { mapGetters, mapActions } from 'vuex'
  9. export default {
  10. components: {
  11. 'cart-item': CartItem
  12. },
  13. computed: mapGetters({
  14. items: 'getCartItems'
  15. }),
  16. methods: {
  17. ...mapActions([
  18. 'addToCart',
  19. 'removeFromCart'
  20. ])
  21. }
  22. }
  23. </script>
  24. <style lang="sass">
  25. .cart-list
  26. width: 100%
  27. height: calc(100% - 100px)
  28. padding: 10px 0
  29. overflow-y: auto
  30. </style>