xxx
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<!--
|
||||
* @Author: chenxuan
|
||||
* @Date: 2022-01-21 11:14:22
|
||||
* @LastEditTime: 2022-01-21 11:27:16
|
||||
* @LastEditors: chenxuan
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>15.6.1-getInitialState</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="../15.6.1/bower_components/react/react.js"></script>
|
||||
<script src="../15.6.1/bower_components/react/react-dom.js"></script>
|
||||
<script src="../15.6.1/bower_components/babel/browser.js"></script>
|
||||
<script type="text/babel">
|
||||
var A1=React.createClass({
|
||||
getInitialState:function(){
|
||||
return {
|
||||
data:[{
|
||||
id:1,
|
||||
name:"陈轩",
|
||||
sex:"男",
|
||||
age:18
|
||||
},{
|
||||
id:2,
|
||||
name:"大侠",
|
||||
sex:"女",
|
||||
age:100
|
||||
},{
|
||||
id:3,
|
||||
name:"大侠1",
|
||||
sex:"男",
|
||||
age:23
|
||||
}]
|
||||
}
|
||||
},
|
||||
render:function(){
|
||||
let person=this.state.data;
|
||||
return(
|
||||
<div>
|
||||
{
|
||||
person.map(function(item){
|
||||
return (
|
||||
<ul key={item.id}>
|
||||
<li>{item.name}</li>
|
||||
<li>{item.sex}</li>
|
||||
<li>{item.age}</li>
|
||||
</ul>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
ReactDOM.render(
|
||||
<A1/>,document.getElementById('app')
|
||||
)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user