CartTotal.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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, 2, '.', ',')
  33. },
  34. getSymbol() {
  35. return this.symbol
  36. }
  37. },
  38. mounted() {
  39. console.log(this)
  40. }
  41. }
  42. </script>
  43. <style lang="sass">
  44. .cart-total
  45. width: 100%
  46. height: 50px
  47. h2
  48. width: 100%
  49. height: inherit
  50. margin: 0
  51. font-size: 30pt
  52. </style>