tab-panel.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6. };
  7. import { SuperComponent, wxComponent } from '../common/src/index';
  8. import props from './tab-panel-props';
  9. import config from '../common/config';
  10. const { prefix } = config;
  11. const name = `${prefix}-tab-panel`;
  12. let TabPanel = class TabPanel extends SuperComponent {
  13. constructor() {
  14. super(...arguments);
  15. this.relations = {
  16. './tabs': {
  17. type: 'ancestor',
  18. },
  19. };
  20. this.properties = props;
  21. this.data = {
  22. prefix,
  23. classPrefix: name,
  24. active: false,
  25. hide: true,
  26. };
  27. this.observers = {
  28. label() {
  29. this.update();
  30. },
  31. };
  32. }
  33. getComputedName() {
  34. if (this.properties.value) {
  35. return `${this.properties.value}`;
  36. }
  37. return `${this.index}`;
  38. }
  39. update() {
  40. if (this.parent) {
  41. this.parent.updateTabs();
  42. }
  43. }
  44. render(active, parent) {
  45. this.setData({
  46. active,
  47. hide: !parent.animated && !active,
  48. });
  49. }
  50. };
  51. TabPanel = __decorate([
  52. wxComponent()
  53. ], TabPanel);
  54. export default TabPanel;
  55. //# sourceMappingURL=tab-panel.js.map