Files
react/basic/5/P01.html
T

44 lines
1.4 KiB
HTML
Raw Normal View History

2022-01-05 23:42:00 +08:00
<!--
* @Author: chenxuan
* @Date: 2022-01-05 22:48:03
2022-08-14 13:42:24 +08:00
* @LastEditTime: 2022-08-13 19:19:05
2022-01-05 23:42:00 +08:00
* @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">
2022-01-10 00:07:02 +08:00
<title>非柯里化</title>
2022-01-05 23:42:00 +08:00
</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 Demo extends React.Component{
2022-03-20 23:55:37 +08:00
state={
name:"xxx"
}
2022-01-10 00:07:02 +08:00
saveData=(dataType,value)=>{
this.setState({[dataType]:value})
2022-01-05 23:42:00 +08:00
}
render(){
return (
<div>
2022-03-20 23:55:37 +08:00
<li>{this.state.passworld}</li>
<li>{this.state.userName}</li>
2022-01-10 00:07:02 +08:00
<input type="text" onChange={(event)=>{this.saveData('userName',event.target.value)}} />
<input type="text" onChange={(event)=>{this.saveData('passworld',event.target.value)}} />
2022-01-05 23:42:00 +08:00
</div>
)
2022-08-14 13:42:24 +08:00
}
2022-01-05 23:42:00 +08:00
}
ReactDOM.render(
<Demo/>,document.getElementById('app')
)
</script>
</body>
</html>