index.js 1.2 KB

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