对于get方法也是如此。像 get(this,'agentName')和 this.get('agentName')返回相同的值。 / p>
在官方 ember doc for get方法,它表明我们应该传递2个值来获取。那么 this.get('agentName')如何准确地工作?
解决方案p> this.get(...)是 Ember.get(this,...)的快捷方式 。但是,它仅在ember对象上可用,因此只有 Ember.get 可以在普通的js对象中使用。
看看 this.get(...)实现。
The same is true for 'get' methods too. Like get(this, 'agentName') and this.get('agentName') returns the same value.
In the official ember doc for get method, it shows that we are supposed to pass 2 values to get. Then how does this.get('agentName') work accurately?
解决方案this.get(...) is a shortcut for Ember.get(this,...). However it is only available on ember objects, so only Ember.get works in plain js objects.
Have a look at this.get(...) implementation.
更多推荐
在Ember中set(this,'agentName','John')和this.set('agentName'
发布评论