mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
using location.hash to initialize tabview correctly
This commit is contained in:
parent
b1b3d408f7
commit
0032069c27
@ -9,6 +9,18 @@ var TabView = React.createClass({
|
||||
return {activeTab: this.props.tabPanes[0]};
|
||||
},
|
||||
|
||||
componentDidMount:function() {
|
||||
var userHash = window.location.hash;
|
||||
if(userHash) {
|
||||
userHash = userHash.split("#")[1];
|
||||
this.props.tabPanes.forEach(function(pane) {
|
||||
if(pane.name === userHash) {
|
||||
this.setState({activeTab: pane})
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
handleChangeTab: function(tabPane) {
|
||||
this.setState({activeTab: tabPane});
|
||||
},
|
||||
|
17
public/js/components/strategy/Strategy.jsx
Normal file
17
public/js/components/strategy/Strategy.jsx
Normal file
@ -0,0 +1,17 @@
|
||||
var React = require('react');
|
||||
|
||||
var StrategyList = React.createClass({
|
||||
propTypes: {
|
||||
strategies: React.PropTypes.array.isRequired
|
||||
},
|
||||
|
||||
render: function() {
|
||||
return (<div>
|
||||
|
||||
{JSON.stringify(this.props.strategies)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = StrategyList;
|
Loading…
Reference in New Issue
Block a user