import {
    inject,
    observer
} from 'mobx-react'
import {
    WeaTab
} from 'ecCom'

@inject('intelogin')
@observer
export default class SubTab extends React.Component {
    constructor(props) {
        super(props);
    }

    componentWillUnmount() {
        this.props.intelogin.resetSubTab()
    }

    render() {
        const {
            intelogin
        } = this.props, {
            sTdatas,
            clickTab,
            sTbuttons,
            subTab,
        } = intelogin, {
            key,
        } = subTab;

        return (
            <WeaTab ecId={`${this && this.props && this.props.ecId || ''}_WeaTab@1fl5j4`}
                datas={sTdatas}
                keyParam='key'
                selectedKey={key}
                onChange={key => clickTab(key)}
                buttons={key=='1' ? sTbuttons : []}
            />
        )

    }
}