56 lines
1.5 KiB
HTML
56 lines
1.5 KiB
HTML
<!--
|
|||
|
|
* @Author: chenxuan
|
||
|
|
* @Date: 2022-01-21 10:24:49
|
||
|
|
* @LastEditTime: 2022-01-21 11:27:40
|
||
|
|
* @LastEditors: chenxuan
|
||
|
|
-->
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<meta charset="utf-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
<title>15.6.1-createClass</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({
|
||
|
|
render(){
|
||
|
|
return(
|
||
|
|
<div>
|
||
|
|
<h1>{this.props.x1}</h1>
|
||
|
|
<h1>{this.props.x2}</h1>
|
||
|
|
</div>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
var A2=React.createClass({
|
||
|
|
render(){
|
||
|
|
return(
|
||
|
|
<div>
|
||
|
|
<h1>{this.props.x1}</h1>
|
||
|
|
<h1>{this.props.x2}</h1>
|
||
|
|
</div>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
var A=React.createClass({
|
||
|
|
render(){
|
||
|
|
return (
|
||
|
|
<div>
|
||
|
|
<A1 x1={this.props.x1}/>
|
||
|
|
<A2 x2={this.props.x2}/>
|
||
|
|
</div>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
ReactDOM.render(
|
||
|
|
<A x1="今天天气不错!" x2="今天天气真的不错!"/>
|
||
|
|
,document.getElementById('app')
|
||
|
|
)
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|