<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../lib/react.development.js"></script>
<script src="../lib/react-dom.development.js"></script>
<script src="../lib/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
</body>
<script type="text/babel">
class My extends React.Component {
constructor() {
super()
this.state = {
num:1
}
console.log("constructor")
}
run(){
console.log("奔跑")
}
componentWilMount(){
//组件内容挂载之前
//即将挂载,但是实例已经
react生命周期之挂载阶段
最新推荐文章于 2024-01-27 23:08:45 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)