import React from 'react'; import { Menu, Icon } from 'antd'; import '../leftTab.less'; const SubMenu = Menu.SubMenu; const MenuItemGroup = Menu.ItemGroup; const LeftTab = React.createClass({ getInitialState() { return { current: 'star', subKey: 'sub1', keyList: [ { key: 'sub1', value: ['star', 'lecture'] }, { key: 'sub2', value: ['flash', 'localPolicy', 'nationalPolicy', 'contact'] }, { key: 'sub10', value: ['banner'] } ] }; }, handleClick(e) { this.props.handlekey(e.key); this.setState({ current: e.key, }); }, componentWillMount() { const _me = this; if (window.location.hash) { let theKey = window.location.hash.substr(1); this.state.keyList.map(function (item1) { item1.value.map(function (item2) { if (theKey == item2) { _me.state.subKey = item1.key }; }); }); this.state.current = theKey; }; }, render() { return ( 大咖说}> 科技明星 科技讲堂 策源地}> 科技快讯 国家政策 地方政策 政府往来 广告图}> 广告图管理 ); } }); export default LeftTab;