index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var relation_1 = require('../common/relation');
  4. var component_1 = require('../common/component');
  5. component_1.VantComponent({
  6. relation: relation_1.useParent('tabs'),
  7. props: {
  8. dot: {
  9. type: Boolean,
  10. observer: 'update',
  11. },
  12. info: {
  13. type: null,
  14. observer: 'update',
  15. },
  16. title: {
  17. type: String,
  18. observer: 'update',
  19. },
  20. disabled: {
  21. type: Boolean,
  22. observer: 'update',
  23. },
  24. titleStyle: {
  25. type: String,
  26. observer: 'update',
  27. },
  28. name: {
  29. type: null,
  30. value: '',
  31. },
  32. },
  33. data: {
  34. active: false,
  35. },
  36. methods: {
  37. getComputedName: function () {
  38. if (this.data.name !== '') {
  39. return this.data.name;
  40. }
  41. return this.index;
  42. },
  43. updateRender: function (active, parent) {
  44. var parentData = parent.data;
  45. this.inited = this.inited || active;
  46. this.setData({
  47. active: active,
  48. shouldRender: this.inited || !parentData.lazyRender,
  49. shouldShow: active || parentData.animated,
  50. });
  51. },
  52. update: function () {
  53. if (this.parent) {
  54. this.parent.updateTabs();
  55. }
  56. },
  57. },
  58. });