CartItems.vue 1015 B

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