mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	using location.hash to initialize tabview correctly
This commit is contained in:
		
							parent
							
								
									0ba223dc4e
								
							
						
					
					
						commit
						5e3920fb42
					
				| @ -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