main.js 924 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. export default {
  2. name: 'NtRow',
  3. componentName: 'NtRow',
  4. props: {
  5. tag: {
  6. type: String,
  7. default: 'div'
  8. },
  9. gutter: Number,
  10. type: String,
  11. justify: {
  12. type: String,
  13. default: 'start'
  14. },
  15. align: {
  16. type: String,
  17. default: 'top'
  18. }
  19. },
  20. computed: {
  21. style() {
  22. const ret = {};
  23. if (this.gutter) {
  24. ret.marginLeft = `-${this.gutter / 2}px`;
  25. ret.marginRight = ret.marginLeft;
  26. }
  27. return ret;
  28. }
  29. },
  30. render(h) {
  31. return h(this.tag, {
  32. class: [
  33. 'nt-row',
  34. this.justify !== 'start' ? `is-justify-${this.justify}` : '',
  35. this.align !== 'top' ? `is-align-${this.align}` : '',
  36. { 'nt-row--flex': this.type === 'flex' }
  37. ],
  38. style: this.style
  39. }, this.$slots.default);
  40. }
  41. };