const app = getApp();
Component({
  props: {
    componentData: {}
  },
  data: {
    imgSrcPrefix: app.globalData.imgSrcPrefix,
    tabs: [],
    activeTab: 0
  },

  didMount() {
    const {
      componentExtInfo = {}
    } = this.props.componentData;
    this.setData({
      tabs: JSON.parse(componentExtInfo.inpatientIndexTab || '[]').map(item => ({
        title: item.tabName,
        ...item
      }))
    });
  },

  methods: {
    handleTabClick({
      index,
      tabsName
    }) {
      this.setData({
        [tabsName]: index
      });
    }

  }
});