class TransitionComp extends Component{
Duration = ()=>{
return Math.floor(Math.random() * Math.floor(3000))
}
render(){
console.log(this.Duration)
return(
)
}
}
控制台正在返回
ƒ () {
return Math.floor(Math.random() * Math.floor(3000));
}
而不是整数。如果我不使用"this",持续时间将变得不确定。
发布于 2018-06-04 07:59:10
调用该函数的正确方法是:
console.log(this.Duration());
https://stackoverflow.com/questions/50672016
复制相似问题