index.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { VantComponent } from '../common/component';
  2. import { useChildren } from '../common/relation';
  3. VantComponent({
  4. relation: useChildren('grid-item'),
  5. props: {
  6. square: {
  7. type: Boolean,
  8. observer: 'updateChildren',
  9. },
  10. gutter: {
  11. type: null,
  12. value: 0,
  13. observer: 'updateChildren',
  14. },
  15. clickable: {
  16. type: Boolean,
  17. observer: 'updateChildren',
  18. },
  19. columnNum: {
  20. type: Number,
  21. value: 4,
  22. observer: 'updateChildren',
  23. },
  24. center: {
  25. type: Boolean,
  26. value: true,
  27. observer: 'updateChildren',
  28. },
  29. border: {
  30. type: Boolean,
  31. value: true,
  32. observer: 'updateChildren',
  33. },
  34. direction: {
  35. type: String,
  36. observer: 'updateChildren',
  37. },
  38. iconSize: {
  39. type: String,
  40. observer: 'updateChildren',
  41. },
  42. reverse: {
  43. type: Boolean,
  44. value: false,
  45. observer: 'updateChildren',
  46. },
  47. },
  48. methods: {
  49. updateChildren() {
  50. this.children.forEach((child) => {
  51. child.updateStyle();
  52. });
  53. },
  54. },
  55. });