index.js 965 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. relation: {
  4. name: 'tabs',
  5. type: 'ancestor'
  6. },
  7. props: {
  8. dot: Boolean,
  9. info: null,
  10. title: String,
  11. disabled: Boolean,
  12. titleStyle: String,
  13. name: {
  14. type: [Number, String],
  15. value: '',
  16. observer: 'setComputedName'
  17. }
  18. },
  19. data: {
  20. width: null,
  21. inited: false,
  22. active: false,
  23. animated: false
  24. },
  25. watch: {
  26. title: 'update',
  27. disabled: 'update',
  28. dot: 'update',
  29. info: 'update',
  30. titleStyle: 'update'
  31. },
  32. methods: {
  33. setComputedName() {
  34. this.computedName = this.data.name || this.index;
  35. },
  36. update() {
  37. const parent = this.getRelationNodes('../tabs/index')[0];
  38. if (parent) {
  39. parent.updateTabs();
  40. }
  41. }
  42. }
  43. });