index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _utils = require("../utils");
  5. var _relation = require("../mixins/relation");
  6. var _createNamespace = (0, _utils.createNamespace)('col'),
  7. createComponent = _createNamespace[0],
  8. bem = _createNamespace[1];
  9. var _default = createComponent({
  10. mixins: [(0, _relation.ChildrenMixin)('vanRow')],
  11. props: {
  12. span: [Number, String],
  13. offset: [Number, String],
  14. tag: {
  15. type: String,
  16. default: 'div'
  17. }
  18. },
  19. computed: {
  20. style: function style() {
  21. var index = this.index;
  22. var _ref = this.parent || {},
  23. spaces = _ref.spaces;
  24. if (spaces && spaces[index]) {
  25. var _spaces$index = spaces[index],
  26. left = _spaces$index.left,
  27. right = _spaces$index.right;
  28. return {
  29. paddingLeft: left ? left + "px" : null,
  30. paddingRight: right ? right + "px" : null
  31. };
  32. }
  33. }
  34. },
  35. methods: {
  36. onClick: function onClick(event) {
  37. this.$emit('click', event);
  38. }
  39. },
  40. render: function render() {
  41. var _bem;
  42. var h = arguments[0];
  43. var span = this.span,
  44. offset = this.offset;
  45. return h(this.tag, {
  46. "style": this.style,
  47. "class": bem((_bem = {}, _bem[span] = span, _bem["offset-" + offset] = offset, _bem)),
  48. "on": {
  49. "click": this.onClick
  50. }
  51. }, [this.slots()]);
  52. }
  53. });
  54. exports.default = _default;