CartItems.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template lang="pug">
  2. .cart-items-wrapper
  3. transition-group(name="list" tag="ul" class="cart-items")
  4. cart-item(v-for="item in items" :key="item" :item="item" :symbol="symbol")
  5. </template>
  6. <script>
  7. import CartItem from '@/components/CartItem'
  8. import { mapGetters, mapActions } from 'vuex'
  9. export default {
  10. props: {
  11. symbol: {
  12. type: String,
  13. default: '$'
  14. }
  15. },
  16. components: {
  17. 'cart-item': CartItem
  18. },
  19. computed: mapGetters({
  20. items: 'getCartItems'
  21. }),
  22. methods: mapActions([
  23. 'addToCart',
  24. 'removeFromCart'
  25. ])
  26. }
  27. </script>
  28. <style lang="sass">
  29. .cart-items-wrapper
  30. width: 100%
  31. height: calc(100% - 125px)
  32. overflow-y: auto
  33. overflow-x: hidden
  34. padding: 0
  35. margin: 15px 0
  36. .cart-items
  37. width: 100%
  38. padding: 0
  39. margin: 0
  40. .list-enter-active, .list-leave-active
  41. transition: all 0.3s
  42. .list-enter, .list-leave-to
  43. opacity: 0
  44. transform: translateX(300px)
  45. </style>