js 常用改变 this 的方式: 更多详情, 自行 Google, func.call(that, arg1, arg2); func.apply(that, [arg1, arg2]); func.bind(that)(arg1, arg2); 调用 少了一个 () 应该是 _self.onDelecte.bind(_self)() 还有从本图来看, 是看不出 this 的问题, 再发下调用 handleDeleteProject 的 代码. PS: 个人比较喜欢使用 class MyComponent extends Component { handleDoSomething = () => { // 使用箭头函数确保使用正确的上下文 // coding... } render() { return ( <div onClick={this.handleDoSomething} /> } }
js 常用改变 this 的方式:
更多详情, 自行 Google,
调用 少了一个
()
应该是_self.onDelecte.bind(_self)()
还有从本图来看, 是看不出 this 的问题, 再发下调用 handleDeleteProject 的 代码.
PS:
个人比较喜欢使用