index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var link_1 = require('../mixins/link');
  4. var component_1 = require('../common/component');
  5. component_1.VantComponent({
  6. relation: {
  7. name: 'grid',
  8. type: 'ancestor',
  9. current: 'grid-item',
  10. },
  11. classes: ['content-class', 'icon-class', 'text-class'],
  12. mixins: [link_1.link],
  13. props: {
  14. icon: String,
  15. iconColor: String,
  16. dot: Boolean,
  17. info: null,
  18. badge: null,
  19. text: String,
  20. useSlot: Boolean,
  21. },
  22. data: {
  23. viewStyle: '',
  24. },
  25. mounted: function () {
  26. this.updateStyle();
  27. },
  28. methods: {
  29. updateStyle: function () {
  30. if (!this.parent) {
  31. return;
  32. }
  33. var _a = this.parent,
  34. data = _a.data,
  35. children = _a.children;
  36. var columnNum = data.columnNum,
  37. border = data.border,
  38. square = data.square,
  39. gutter = data.gutter,
  40. clickable = data.clickable,
  41. center = data.center,
  42. direction = data.direction,
  43. iconSize = data.iconSize;
  44. this.setData({
  45. center: center,
  46. border: border,
  47. square: square,
  48. gutter: gutter,
  49. clickable: clickable,
  50. direction: direction,
  51. iconSize: iconSize,
  52. index: children.indexOf(this),
  53. columnNum: columnNum,
  54. });
  55. },
  56. onClick: function () {
  57. this.$emit('click');
  58. this.jumpLink();
  59. },
  60. },
  61. });