render(){
return
}
我想在this.turn.bind(this)中的turn方法的参数中传递这个p元素自身如何实现?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
或者就直接传事件对象过去, 在 turn 方法里用 target 获取(我基本都是这么做的).
不知道你要这个p元素是干嘛用的。。。
首先你不需要
bind,直接在turn方法拿到的event对象中获取就好了。其次,其实既然你再用
react,就多用react的方式来写代码。如果你是想要让图片反转,你可以通过state状态来做这个,不需要对dom进行操作。