index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. dot: Boolean,
  12. info: null,
  13. badge: null,
  14. text: String,
  15. useSlot: Boolean,
  16. },
  17. data: {
  18. viewStyle: '',
  19. },
  20. mounted() {
  21. this.updateStyle();
  22. },
  23. methods: {
  24. updateStyle() {
  25. if (!this.parent) {
  26. return;
  27. }
  28. const { data, children } = this.parent;
  29. const {
  30. columnNum,
  31. border,
  32. square,
  33. gutter,
  34. clickable,
  35. center,
  36. direction,
  37. iconSize,
  38. } = data;
  39. this.setData({
  40. center,
  41. border,
  42. square,
  43. gutter,
  44. clickable,
  45. direction,
  46. iconSize,
  47. index: children.indexOf(this),
  48. columnNum,
  49. });
  50. },
  51. onClick() {
  52. this.$emit('click');
  53. this.jumpLink();
  54. },
  55. },
  56. });