1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { VantComponent } from '../common/component';
  2. import { iphonex } from '../mixins/iphonex';
  3. VantComponent({
  4. mixins: [iphonex],
  5. classes: [
  6. 'bar-class',
  7. 'price-class',
  8. 'button-class'
  9. ],
  10. props: {
  11. tip: null,
  12. type: Number,
  13. price: null,
  14. label: String,
  15. loading: Boolean,
  16. disabled: Boolean,
  17. buttonText: String,
  18. currency: {
  19. type: String,
  20. value: '¥'
  21. },
  22. buttonType: {
  23. type: String,
  24. value: 'danger'
  25. }
  26. },
  27. computed: {
  28. hasPrice() {
  29. return typeof this.data.price === 'number';
  30. },
  31. priceStr() {
  32. return (this.data.price / 100).toFixed(2);
  33. },
  34. tipStr() {
  35. const { tip } = this.data;
  36. return typeof tip === 'string' ? tip : '';
  37. }
  38. },
  39. methods: {
  40. onSubmit(event) {
  41. this.$emit('submit', event.detail);
  42. }
  43. }
  44. });