CartItems.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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% - 100px)
  32. overflow-y: auto
  33. overflow-x: hidden
  34. .cart-items
  35. width: 100%
  36. padding: 0
  37. margin: 0
  38. .list-enter-active, .list-leave-active
  39. transition: all 0.3s
  40. .list-enter, .list-leave-to
  41. opacity: 0
  42. transform: translateX(300px)
  43. </style>