-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy paths3.html
More file actions
48 lines (39 loc) · 1.27 KB
/
Copy paths3.html
File metadata and controls
48 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<html>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h1><span class="label label-info">DEMO 3</span></h1>
<br><br><br>
<div class="well" id="well">
</div>
<script src="js/jquery.min.js"></script>
<script src="js/react.js"></script>
<script src="js/react-dom.js"></script>
<script src="js/browser.min.js"></script>
<script type="text/babel">
var Text = React.createClass({
getInitialState: function() {
return {name: "react"};
},
keyUp: function(e){
this.setState({name: e.target.value}, function(){
console.log(this.state.name);
})
},
render: function() {
return (
<div className="a">
大家好,我是用{this.state.name}渲染出来的!
<input onKeyUp={this.keyUp} />
</div>
);
}
});
ReactDOM.render(
<Text></Text>,
document.getElementById('well')
);
</script>
</body>
</html>