mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
improved logic to set inital active pane
This commit is contained in:
parent
0032069c27
commit
f472bf8585
@ -6,19 +6,19 @@ var TabView = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
return {activeTab: this.props.tabPanes[0]};
|
var activeTab = this.props.tabPanes[0];
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount:function() {
|
|
||||||
var userHash = window.location.hash;
|
var userHash = window.location.hash;
|
||||||
if(userHash) {
|
if(userHash) {
|
||||||
userHash = userHash.split("#")[1];
|
userHash = userHash.split("#")[1];
|
||||||
this.props.tabPanes.forEach(function(pane) {
|
this.props.tabPanes.forEach(function(pane) {
|
||||||
if(pane.name === userHash) {
|
if(pane.name === userHash) {
|
||||||
this.setState({activeTab: pane})
|
activeTab = pane;
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {activeTab: activeTab};
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChangeTab: function(tabPane) {
|
handleChangeTab: function(tabPane) {
|
||||||
|
Loading…
Reference in New Issue
Block a user