Commit 4adcd871 by wangshuo

tabs bug 修改

parent a9864947
...@@ -11,7 +11,8 @@ class OutLine extends Component { ...@@ -11,7 +11,8 @@ class OutLine extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
stageInfo: [] stageInfo: [],
tab: 0,
} }
} }
...@@ -44,8 +45,10 @@ class OutLine extends Component { ...@@ -44,8 +45,10 @@ class OutLine extends Component {
}) })
} }
change = (index) => { changeTab = (tab, index) => {
console.log(index); this.setState({
tab: index
})
} }
render() { render() {
...@@ -61,28 +64,28 @@ class OutLine extends Component { ...@@ -61,28 +64,28 @@ class OutLine extends Component {
<div className='course-detail'> <div className='course-detail'>
<WhiteSpace/> <WhiteSpace/>
<StickyContainer> <StickyContainer>
<div className='detail_tab'>
{
tabs.map((item, index) => {
return <div onClick={e => change(index)} className="tabItem" key={index}>
<span>{item.title}</span>
</div>
})
}
</div>
<Tabs tabs={tabs} <Tabs tabs={tabs}
initialPage={0} initialPage={0}
swipeable={false} swipeable={false}
onTabClick={(tab, index) => this.changeTab(tab, index)}
// renderTabBar={RenderTabBar} // renderTabBar={RenderTabBar}
> >
</Tabs>
{/*介绍*/} {/*介绍*/}
{
this.state.tab === 0 ? (
<div className='introduce'> <div className='introduce'>
<p>讲师:{introduce.teachers}</p> <p>讲师:{introduce.teachers}</p>
<p>课时:{introduce.course_hour}</p> <p>课时:{introduce.course_hour}</p>
<p>时间:{introduce.start_time}</p> <p>时间:{introduce.start_time}</p>
<div className='dec' dangerouslySetInnerHTML={{__html: this.htmlDecode(introduce.intro)}}></div> <div className='dec' dangerouslySetInnerHTML={{__html: this.htmlDecode(introduce.intro)}}></div>
</div> </div>
) : null
}
{/*大纲*/} {/*大纲*/}
{
this.state.tab === 1 ? (
<div className='outline'> <div className='outline'>
{ {
this.state.stageInfo && this.state.stageInfo.length > 0 && this.state.stageInfo.map((item, index) => { this.state.stageInfo && this.state.stageInfo.length > 0 && this.state.stageInfo.map((item, index) => {
...@@ -214,7 +217,8 @@ class OutLine extends Component { ...@@ -214,7 +217,8 @@ class OutLine extends Component {
}) })
} }
</div> </div>
</Tabs> ) : null
}
</StickyContainer> </StickyContainer>
<WhiteSpace/> <WhiteSpace/>
</div> </div>
......
...@@ -185,25 +185,4 @@ ...@@ -185,25 +185,4 @@
background-color: $bg_FE2F2F; background-color: $bg_FE2F2F;
} }
} }
.detail_tab {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 46px;
.tabItem {
display: flex;
justify-content: center;
align-items: center;
width: 50%;
span {
display: inline-block;
height: 100%;
border-bottom: 1px solid #09f;
padding: 6px 0;
}
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment