index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { createNamespace, addUnit } from '../utils';
  2. import { BORDER_TOP } from '../utils/constant';
  3. import { ParentMixin } from '../mixins/relation';
  4. var _createNamespace = createNamespace('grid'),
  5. createComponent = _createNamespace[0],
  6. bem = _createNamespace[1];
  7. export default createComponent({
  8. mixins: [ParentMixin('vanGrid')],
  9. props: {
  10. square: Boolean,
  11. gutter: [Number, String],
  12. iconSize: [Number, String],
  13. direction: String,
  14. clickable: Boolean,
  15. columnNum: {
  16. type: [Number, String],
  17. default: 4
  18. },
  19. center: {
  20. type: Boolean,
  21. default: true
  22. },
  23. border: {
  24. type: Boolean,
  25. default: true
  26. }
  27. },
  28. computed: {
  29. style: function style() {
  30. var gutter = this.gutter;
  31. if (gutter) {
  32. return {
  33. paddingLeft: addUnit(gutter)
  34. };
  35. }
  36. }
  37. },
  38. render: function render() {
  39. var _ref;
  40. var h = arguments[0];
  41. return h("div", {
  42. "style": this.style,
  43. "class": [bem(), (_ref = {}, _ref[BORDER_TOP] = this.border && !this.gutter, _ref)]
  44. }, [this.slots()]);
  45. }
  46. });