goToDetail(){console.log("看看能出来吗?")}renderComment({name,author,uploadTime,description,category,sraID}){switch(category){case"0":return"other";case"1":return"project";case"2":return"paper";case"3":return"book";case"4":return"certificate";case"5":return"patent";case"6":return"picture";}return({name}{author}-{uploadTime}描述:{description});}render(){if(this.state.contents){return({this.state.contents.map(this.renderComment)})}else{return()}}不知道什么原因,求大神解答。。。
2 回答
慕码人2483693
TA贡献1860条经验 获得超9个赞
手动绑定下thisconstructor(){super();this.renderComment=this.renderComment.bind(this);}用箭头函数renderComment=()=>{}
添加回答
举报
0/150
提交
取消