2022-01-11 15:42:13 +08:00
|
|
|
<!--
|
|
|
|
|
* @Author: chenxuan
|
|
|
|
|
* @Date: 2022-01-11 15:18:55
|
|
|
|
|
* @LastEditTime: 2022-01-11 15:33:40
|
|
|
|
|
* @LastEditors: chenxuan
|
|
|
|
|
-->
|
2021-02-06 23:26:34 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en" dir="ltr">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
|
|
|
<title>自定义组件</title>
|
2022-01-11 15:42:13 +08:00
|
|
|
<script src="../bower_components/react/react.js"></script>
|
|
|
|
|
<script src="../bower_components/react/react-dom.js"></script>
|
|
|
|
|
<script src="../bower_components/babel/browser.js"></script>
|
2021-02-06 23:26:34 +08:00
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="app"></div>
|
|
|
|
|
<script type="text/babel">
|
|
|
|
|
//定义组件
|
|
|
|
|
var Test=React.createClass({
|
|
|
|
|
render:function(){
|
|
|
|
|
return <h2>hello word!</h2>
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
//组件调用
|
|
|
|
|
ReactDOM.render(
|
|
|
|
|
<Test/>
|
|
|
|
|
,document.getElementById('app')
|
|
|
|
|
)
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|