index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. "use strict";
  2. var _component = require("../common/component");
  3. (0, _component.VantComponent)({
  4. relation: {
  5. name: "tabs",
  6. type: "ancestor",
  7. current: "tab"
  8. },
  9. props: {
  10. dot: {
  11. type: Boolean,
  12. observer: "update"
  13. },
  14. info: {
  15. type: null,
  16. observer: "update"
  17. },
  18. title: {
  19. type: String,
  20. observer: "update"
  21. },
  22. disabled: {
  23. type: Boolean,
  24. observer: "update"
  25. },
  26. titleStyle: {
  27. type: String,
  28. observer: "update"
  29. },
  30. name: {
  31. type: [Number, String],
  32. value: ""
  33. }
  34. },
  35. data: {
  36. active: false,
  37. shouldShow: false
  38. },
  39. methods: {
  40. getComputedName: function getComputedName() {
  41. if (this.data.name !== "") {
  42. return this.data.name;
  43. }
  44. return this.index;
  45. },
  46. updateRender: function updateRender(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 update() {
  56. if (this.parent) {
  57. this.parent.updateTabs();
  58. }
  59. }
  60. }
  61. });