SkuActions.js 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
  2. import { use } from '../../utils';
  3. import { inherit } from '../../utils/functional';
  4. import Button from '../../button'; // Types
  5. var _use = use('sku-actions'),
  6. sfc = _use[0],
  7. bem = _use[1];
  8. function SkuActions(h, props, slots, ctx) {
  9. var emit = function emit(name) {
  10. return function () {
  11. props.skuEventBus.$emit(name);
  12. };
  13. };
  14. return h("div", _mergeJSXProps([{
  15. "class": bem()
  16. }, inherit(ctx)]), [props.showAddCartBtn && h(Button, {
  17. "attrs": {
  18. "bottomAction": true,
  19. "text": "加入购物车"
  20. },
  21. "on": {
  22. "click": emit('sku:addCart')
  23. }
  24. }), h(Button, {
  25. "attrs": {
  26. "type": "primary",
  27. "bottomAction": true,
  28. "text": props.buyText || '立即购买'
  29. },
  30. "on": {
  31. "click": emit('sku:buy')
  32. }
  33. })]);
  34. }
  35. SkuActions.props = {
  36. buyText: String,
  37. skuEventBus: Object,
  38. showAddCartBtn: Boolean
  39. };
  40. export default sfc(SkuActions);