index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var component_1 = require("../common/component");
  4. var safe_area_1 = require("../mixins/safe-area");
  5. component_1.VantComponent({
  6. mixins: [safe_area_1.safeArea()],
  7. classes: [
  8. 'bar-class',
  9. 'price-class',
  10. 'button-class'
  11. ],
  12. props: {
  13. tip: {
  14. type: null,
  15. observer: 'updateTip'
  16. },
  17. tipIcon: String,
  18. type: Number,
  19. price: {
  20. type: null,
  21. observer: 'updatePrice'
  22. },
  23. label: String,
  24. loading: Boolean,
  25. disabled: Boolean,
  26. buttonText: String,
  27. currency: {
  28. type: String,
  29. value: '¥'
  30. },
  31. buttonType: {
  32. type: String,
  33. value: 'danger'
  34. },
  35. decimalLength: {
  36. type: Number,
  37. value: 2,
  38. observer: 'updatePrice'
  39. },
  40. suffixLabel: String
  41. },
  42. methods: {
  43. updatePrice: function () {
  44. var _a = this.data, price = _a.price, decimalLength = _a.decimalLength;
  45. this.set({
  46. hasPrice: typeof price === 'number',
  47. priceStr: (price / 100).toFixed(decimalLength)
  48. });
  49. },
  50. updateTip: function () {
  51. this.set({ hasTip: typeof this.data.tip === 'string' });
  52. },
  53. onSubmit: function (event) {
  54. this.$emit('submit', event.detail);
  55. }
  56. }
  57. });