CartTotal.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template lang="pug">
  2. .cart-total
  3. h2
  4. small.cart-total-currency {{ getSymbol() }}
  5. |
  6. | {{ getTotal() }}
  7. </template>
  8. <script>
  9. import { mapGetters } from 'vuex'
  10. export default {
  11. props: {
  12. total: {
  13. type: Number,
  14. required: true
  15. },
  16. symbol: {
  17. type: String,
  18. required: true,
  19. default: '$'
  20. },
  21. separator: {
  22. type: String,
  23. default: '.'
  24. },
  25. decimals: {
  26. type: Number,
  27. default: 0
  28. }
  29. },
  30. methods: {
  31. getTotal() {
  32. return accounting.format(this.total, this.decimals, this.separator, ',')
  33. },
  34. getSymbol() {
  35. return this.symbol
  36. }
  37. }
  38. }
  39. </script>
  40. <style lang="sass">
  41. .cart-total
  42. width: 100%
  43. height: 50px
  44. h2
  45. width: 100%
  46. height: inherit
  47. margin: 0
  48. font-size: 30pt
  49. </style>