Files
react/basic/7/index.html
T
2022-05-01 19:27:52 +08:00

41 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
* @Author: chenxuan
* @Date: 2022-01-15 19:51:19
* @LastEditTime: 2022-01-15 19:56:39
* @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>Document</title>
</head>
<body>
<div id="app"></div>
<script src="../package/old/react.development.js"></script>
<script src="../package/old/react-dom.development.js"></script>
<script src="../package/old/babel.min.js"></script>
<script type="text/babel">
class Time extends React.Component{
state={date:new Date()}
render(){
return (
<div>
<h1>hello!</h1>
<input type="text"/>
<span>现在是:{this.state.date.toTimeString()}</span>
</div>
)
}
componentDidMount(){
setInterval(()=>{
this.setState({date:new Date()})
},1000)
}
}
ReactDOM.render(<Time/>,document.getElementById('app'))
</script>
</body>
</html>