index.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3. exports.__esModule = true;
  4. exports["default"] = void 0;
  5. var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
  6. var _utils = require("../utils");
  7. var _functional = require("../utils/functional");
  8. var _button = _interopRequireDefault(require("../button"));
  9. var _use = (0, _utils.use)('submit-bar'),
  10. sfc = _use[0],
  11. bem = _use[1],
  12. t = _use[2];
  13. function SubmitBar(h, props, slots, ctx) {
  14. var tip = props.tip,
  15. price = props.price;
  16. var hasPrice = typeof price === 'number';
  17. return h("div", (0, _babelHelperVueJsxMergeProps["default"])([{
  18. "class": bem({
  19. 'safe-area-inset-bottom': props.safeAreaInsetBottom
  20. })
  21. }, (0, _functional.inherit)(ctx)]), [slots.top && slots.top(), (slots.tip || tip) && h("div", {
  22. "class": bem('tip')
  23. }, [tip, slots.tip && slots.tip()]), h("div", {
  24. "class": bem('bar')
  25. }, [slots["default"] && slots["default"](), h("div", {
  26. "class": bem('text')
  27. }, [hasPrice && [h("span", [props.label || t('label')]), h("span", {
  28. "class": bem('price')
  29. }, [props.currency + " " + (price / 100).toFixed(props.decimalLength)])]]), h(_button["default"], {
  30. "attrs": {
  31. "square": true,
  32. "size": "large",
  33. "type": props.buttonType,
  34. "loading": props.loading,
  35. "disabled": props.disabled,
  36. "text": props.loading ? '' : props.buttonText
  37. },
  38. "on": {
  39. "click": function click() {
  40. (0, _functional.emit)(ctx, 'submit');
  41. }
  42. }
  43. })])]);
  44. }
  45. SubmitBar.props = {
  46. tip: String,
  47. label: String,
  48. loading: Boolean,
  49. disabled: Boolean,
  50. buttonText: String,
  51. safeAreaInsetBottom: Boolean,
  52. price: {
  53. type: Number,
  54. "default": null
  55. },
  56. decimalLength: {
  57. type: Number,
  58. "default": 2
  59. },
  60. currency: {
  61. type: String,
  62. "default": '¥'
  63. },
  64. buttonType: {
  65. type: String,
  66. "default": 'danger'
  67. }
  68. };
  69. var _default = sfc(SubmitBar);
  70. exports["default"] = _default;