Ami*_*avi 14 javascript reactjs
我在一些react-js库中看到了类似下面的语法.这是什么意思,我的代码如何帮助我?
const inputAttributes = {
id: 'events-playground',
placeholder: 'Where are you now?',
onChange: ::this.onInputChanged,
onBlur: ::this.onInputBlurred
};
Run Code Online (Sandbox Code Playgroud)
谢谢.
Ale*_* T. 25
它是.bind的新ES7语法,
等同于ES5
const inputAttributes = {
id: 'events-playground',
placeholder: 'Where are you now?',
onChange: this.onInputChanged.bind(this),
onBlur: this.onInputBlurred.bind(this)
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3241 次 |
| 最近记录: |