index.js 842 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { use } from '../utils';
  2. var _use = use('row'),
  3. sfc = _use[0],
  4. bem = _use[1];
  5. export default sfc({
  6. props: {
  7. type: String,
  8. align: String,
  9. justify: String,
  10. tag: {
  11. type: String,
  12. "default": 'div'
  13. },
  14. gutter: {
  15. type: [Number, String],
  16. "default": 0
  17. }
  18. },
  19. render: function render(h) {
  20. var _bem;
  21. var align = this.align,
  22. justify = this.justify;
  23. var flex = this.type === 'flex';
  24. var margin = "-" + Number(this.gutter) / 2 + "px";
  25. var style = this.gutter ? {
  26. marginLeft: margin,
  27. marginRight: margin
  28. } : {};
  29. return h(this.tag, {
  30. "style": style,
  31. "class": bem((_bem = {
  32. flex: flex
  33. }, _bem["align-" + align] = flex && align, _bem["justify-" + justify] = flex && justify, _bem))
  34. }, [this.slots()]);
  35. }
  36. });