index.js 567 B

1234567891011121314151617181920212223242526272829303132333435
  1. const app = getApp();
  2. Component({
  3. props: {
  4. componentData: {}
  5. },
  6. data: {
  7. imgSrcPrefix: app.globalData.imgSrcPrefix,
  8. tabs: [],
  9. activeTab: 0
  10. },
  11. didMount() {
  12. const {
  13. componentExtInfo = {}
  14. } = this.props.componentData;
  15. this.setData({
  16. tabs: JSON.parse(componentExtInfo.inpatientIndexTab || '[]').map(item => ({
  17. title: item.tabName,
  18. ...item
  19. }))
  20. });
  21. },
  22. methods: {
  23. handleTabClick({
  24. index,
  25. tabsName
  26. }) {
  27. this.setData({
  28. [tabsName]: index
  29. });
  30. }
  31. }
  32. });