Comparing version 0.6.7 to 0.6.8
@@ -8,27 +8,34 @@ import React from "react"; | ||
onTabTitle(data, index) { | ||
let {onSelect} = this.props; | ||
getInitialState() { | ||
return { | ||
tabIndex: this.props.selected || 0 | ||
}; | ||
}, | ||
componentDidUpdate(preProps) { | ||
if (preProps.selected !== this.props.selected) { | ||
this.onTabTitle(this.props.selected); | ||
} | ||
}, | ||
onTabTitle(index) { | ||
let {tabs, onSelect} = this.props; | ||
this.setState({ | ||
tabIndex: index | ||
}); | ||
onSelect(data, index); | ||
onSelect(tabs[index], index); | ||
}, | ||
getInitialState() { | ||
return { | ||
tabIndex: this.props.selected || 0 | ||
}; | ||
}, | ||
render() { | ||
let {data, activeClass}=this.props; | ||
let {tabs, activeClass}=this.props; | ||
let {tabIndex}=this.state; | ||
return ( | ||
<FixedContent className={styles.this}> | ||
<FixedContent className={styles.this} width={750}> | ||
<div className={styles.tabBox}> | ||
<ul className={styles.tabTitle}> | ||
{ | ||
data.map((n, index)=> { | ||
tabs.map((tab, index)=> { | ||
return ( | ||
<li key={index} style={{width:100/data.length + "%"}} onClick={()=>this.onTabTitle(n,index)} | ||
className={(tabIndex === index) && (activeClass || styles.on)}>{n.title}</li> | ||
<li key={index} style={{width:100/tabs.length + "%"}} onClick={()=>this.onTabTitle(index)} | ||
className={(tabIndex === index) && (activeClass || styles.on)}>{tab.title}</li> | ||
) | ||
@@ -35,0 +42,0 @@ })} |
{ | ||
"name": "fengui", | ||
"version": "0.6.7", | ||
"version": "0.6.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/fengjr", |
322764
5736