SkuActions.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // Utils
  10. // Components
  11. var _createNamespace = (0, _utils.createNamespace)('sku-actions'),
  12. createComponent = _createNamespace[0],
  13. bem = _createNamespace[1],
  14. t = _createNamespace[2];
  15. function SkuActions(h, props, slots, ctx) {
  16. var createEmitter = function createEmitter(name) {
  17. return function () {
  18. props.skuEventBus.$emit(name);
  19. };
  20. };
  21. return h("div", (0, _babelHelperVueJsxMergeProps.default)([{
  22. "class": bem()
  23. }, (0, _functional.inherit)(ctx)]), [props.showAddCartBtn && h(_button.default, {
  24. "attrs": {
  25. "size": "large",
  26. "type": "warning",
  27. "text": props.addCartText || t('addCart')
  28. },
  29. "on": {
  30. "click": createEmitter('sku:addCart')
  31. }
  32. }), h(_button.default, {
  33. "attrs": {
  34. "size": "large",
  35. "type": "danger",
  36. "text": props.buyText || t('buy')
  37. },
  38. "on": {
  39. "click": createEmitter('sku:buy')
  40. }
  41. })]);
  42. }
  43. SkuActions.props = {
  44. buyText: String,
  45. addCartText: String,
  46. skuEventBus: Object,
  47. showAddCartBtn: Boolean
  48. };
  49. var _default = createComponent(SkuActions);
  50. exports.default = _default;