Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议:1.3之后未bind检测 #3340

Closed
excxapp opened this issue Jun 6, 2019 · 6 comments
Closed

建议:1.3之后未bind检测 #3340

excxapp opened this issue Jun 6, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@excxapp
Copy link

excxapp commented Jun 6, 2019

  • 该问题没有在其他 issue 和文档讨论到,不属于重复内容

升级1.3之后所有事件必须写bind(this
但是很多之前的都没有,建议添加批量修改软件,降低升级成本。
或者使用doctor检测出来
image

@taro-bot
Copy link

taro-bot bot commented Jun 6, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Chen-jj
Copy link
Contributor

Chen-jj commented Jun 6, 2019

@excxapp 之前的实现在小程序平台会帮开发者 bind,但如果你 build h5 的话还是会报错让你 bind 的。所以我觉得这里应该和 react 统一,开发者手动 bind,也符合 JS 直观。

@Chen-jj Chen-jj added answered question Further information is requested labels Jun 6, 2019
@yuche
Copy link
Contributor

yuche commented Jun 6, 2019

也不是所有事件都需要 bind this,如果你写之前在构造器 bind 可以不用,在类属性写箭头函数也不用,在构造器写箭头函数重新赋值也不用,写柯里化也不用,直接在事件处写箭头函数也不用,除了直接在事件处写箭头函数之外,别的方法都无法检测到是不是需要 bind。

如果做一刀切的改动反而会让不少自己代码没问题的开发者产生疑惑,我觉得还是开发者自己动手比较合适。

@Lionad-Morotar
Copy link

的确有些脑瓜疼

@taro-bot taro-bot bot added the to be closed label Jun 6, 2019
@taro-bot
Copy link

taro-bot bot commented Jun 6, 2019

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@luckyadam luckyadam removed answered question Further information is requested labels Jun 6, 2019
@luckyadam
Copy link
Member

我们看看 taro doctor 能不能识别出来

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants