index.js 1.2 KB

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