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
文章并非转载