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

请问对象handle中的key和shortcut有什么区别 #7

Open
weidapao opened this issue Jun 14, 2018 · 3 comments
Open

请问对象handle中的key和shortcut有什么区别 #7

weidapao opened this issue Jun 14, 2018 · 3 comments

Comments

@weidapao
Copy link

 if (this.props.keyName.indexOf(this.handle.shortcut) < 0) return;

请问这句话是什么作用,感觉不会出现小于0的情况。

@weidapao
Copy link
Author

还想问一个问题,为什么不把isKeyDown,handle等写在组件的state上

@jaywcjlove
Copy link
Owner

jaywcjlove commented Jun 14, 2018

@weidapao

第一个问题有可能出现的。

第二个问题,state 有延迟,使用 state 需要维护一个 componentWillReceiveProps 生命周期函数,个人觉得这个不需要数据绑定功能,所以没有使用 state

@weidapao
Copy link
Author

感谢回答,还有一点,handle的key和shortcut属性有啥区别

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

No branches or pull requests

2 participants