11
22import React , { PropTypes , Component } from 'react' ;
3- import { Modal , Button , FormGroup , FormControl , HelpBlock , ControlLabel } from 'react-bootstrap' ;
3+ import { Modal , Button , FormGroup , FormControl , HelpBlock , ControlLabel , Col } from 'react-bootstrap' ;
44
55class PopAddApp extends Component {
66 static propTypes = {
7- value : PropTypes . string ,
7+ submit : PropTypes . func ,
88 } ;
99
1010 static defaultProps = {
11- value : '' ,
11+ submit : ( name ) => { } ,
1212 } ;
1313
1414 constructor ( ) {
1515 super ( ) ;
1616 this . close = this . close . bind ( this ) ;
1717 this . open = this . open . bind ( this ) ;
18- this . state = { showModal : false } ;
18+ this . setName = this . setName . bind ( this ) ;
19+ this . setSelect = this . setSelect . bind ( this ) ;
20+ this . submit = this . submit . bind ( this ) ;
21+ this . state = { showModal : false , select :0 , name : '' } ;
22+ }
23+
24+ setSelect ( event ) {
25+ this . setState ( { select : event . target . value } )
26+ }
27+
28+ setName ( event ) {
29+ this . setState ( { name : event . target . value } )
30+ }
31+
32+ submit ( ) {
33+ this . props . submit ( name ) ;
1934 }
2035
2136 close ( ) {
@@ -34,17 +49,28 @@ class PopAddApp extends Component {
3449 </ Modal . Header >
3550 < Modal . Body >
3651 < FormGroup >
37- < ControlLabel > App名字</ ControlLabel >
52+ < ControlLabel style = { { display : 'block' } } > App名字</ ControlLabel >
3853 < FormControl
39- value = { this . props . value }
54+ style = { { display :'inline-block' , width :'60%' } }
55+ onChange = { this . setName }
56+ value = { this . state . value }
4057 type = "text"
4158 />
59+ < FormControl
60+ style = { { display :'inline-block' , marginLeft : 10 , width :'30%' } }
61+ componentClass = 'select'
62+ onChange = { this . setSelect }
63+ >
64+ < option value = "0" > 请选择后缀</ option >
65+ < option value = "1" > -ios</ option >
66+ < option value = "2" > -android</ option >
67+ </ FormControl >
4268 < HelpBlock > 必须以后缀(-ios|-android)命名</ HelpBlock >
4369 </ FormGroup >
4470 </ Modal . Body >
4571 < Modal . Footer >
4672 < Button onClick = { this . close } > 关闭</ Button >
47- < Button onClick = { this . close } > 确定</ Button >
73+ < Button onClick = { this . submit } > 确定</ Button >
4874 </ Modal . Footer >
4975 </ Modal >
5076 )
0 commit comments