版权声明:转载请注明出处https://blog.csdn.net/weixin_42046201 https://blog.csdn.net/weixin_42046201/article/details/82693606
import React from "react"
export default class Index extends React.Component{
constructor(props){
super(props)
this.state={}
}
componentDidMount(){ //在这写didmount的原因是目前React版本的原因 //注释
this.console()
}
console(){
alert("我被调用了")
}
render(){
return(...)
}
}
注释:详情https://www.imooc.com/article/27954?block_id=tuijian_wz
文章并非转载