index.js 682 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. props: {
  4. info: null,
  5. icon: String,
  6. dot: Boolean
  7. },
  8. relation: {
  9. name: 'tabbar',
  10. type: 'ancestor'
  11. },
  12. data: {
  13. active: false
  14. },
  15. methods: {
  16. onClick: function onClick() {
  17. var parent = this.getRelationNodes('../tabbar/index')[0];
  18. if (parent) {
  19. parent.onChange(this);
  20. }
  21. this.$emit('click');
  22. },
  23. setActive: function setActive(_ref) {
  24. var active = _ref.active,
  25. color = _ref.color;
  26. if (this.data.active !== active) {
  27. this.set({
  28. active: active,
  29. color: color
  30. });
  31. }
  32. }
  33. }
  34. });