index.js 660 B

1234567891011121314151617181920212223242526272829
  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() {
  17. const parent = this.getRelationNodes('../tabbar/index')[0];
  18. if (parent) {
  19. parent.onChange(this);
  20. }
  21. this.$emit('click');
  22. },
  23. setActive({ active, color }) {
  24. if (this.data.active !== active) {
  25. this.set({ active, color });
  26. }
  27. }
  28. }
  29. });