index.js 904 B

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