index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. "use strict";
  2. var _component = require("../common/component");
  3. var _utils = require("../common/utils");
  4. var _my = require("../../__antmove/api/index.js")(my);
  5. var wx = _my;
  6. (0, _component.VantComponent)({
  7. relation: {
  8. name: "grid-item",
  9. type: "descendant",
  10. current: "grid"
  11. },
  12. props: {
  13. square: {
  14. type: Boolean,
  15. observer: "updateChildren"
  16. },
  17. gutter: {
  18. type: [Number, String],
  19. value: 0,
  20. observer: "updateChildren"
  21. },
  22. clickable: {
  23. type: Boolean,
  24. observer: "updateChildren"
  25. },
  26. columnNum: {
  27. type: Number,
  28. value: 4,
  29. observer: "updateChildren"
  30. },
  31. center: {
  32. type: Boolean,
  33. value: true,
  34. observer: "updateChildren"
  35. },
  36. border: {
  37. type: Boolean,
  38. value: true,
  39. observer: "updateChildren"
  40. },
  41. direction: {
  42. type: String,
  43. observer: "updateChildren"
  44. },
  45. iconSize: {
  46. type: String,
  47. observer: "updateChildren"
  48. }
  49. },
  50. data: {
  51. viewStyle: ""
  52. },
  53. created: function created() {
  54. var gutter = this.data.gutter;
  55. if (gutter) {
  56. this.setData({
  57. viewStyle: "padding-left: ".concat((0, _utils.addUnit)(gutter))
  58. });
  59. }
  60. },
  61. mounted: function mounted() {
  62. this.updateChildren();
  63. },
  64. methods: {
  65. updateChildren: function updateChildren() {
  66. var _this = this;
  67. wx.nextTick(function () {
  68. _this.children.forEach(function (child) {
  69. child.updateStyle();
  70. });
  71. }, 500);
  72. }
  73. }
  74. });