admin管理员组文章数量:1328549
I'm building an application with ExtJS 6. I've already read the guides, tutorials and best practice tips. But what I dont understand yet is, why should I use the config object?
With config:
Ext.define('MyProject.foo.Bar', {
extends: 'Ext.window.Window',
...
config: {
title: 'My title'
}
});
Without config:
Ext.define('MyProject.foo.Bar', {
extends: 'Ext.window.Window',
...
title: 'My title'
});
Both are working as expected. Can anyone tell me the difference and possible benefits?
I'm building an application with ExtJS 6. I've already read the guides, tutorials and best practice tips. But what I dont understand yet is, why should I use the config object?
With config:
Ext.define('MyProject.foo.Bar', {
extends: 'Ext.window.Window',
...
config: {
title: 'My title'
}
});
Without config:
Ext.define('MyProject.foo.Bar', {
extends: 'Ext.window.Window',
...
title: 'My title'
});
Both are working as expected. Can anyone tell me the difference and possible benefits?
Share Improve this question edited Sep 22, 2015 at 6:34 Tarabass 3,1502 gold badges19 silver badges35 bronze badges asked Sep 21, 2015 at 7:04 xhadonxhadon 87615 silver badges33 bronze badges1 Answer
Reset to default 10It's all described in the Class System guide:
- Configurations are pletely encapsulated from other class members
- Getter and setter methods for every config property are automatically generated into the class prototype during class creation if methods are not already defined.
- The auto-generated setter method calls the apply method (if defined on the class) internally before setting the value. You may override the apply method for a config property if you need to run custom logic before setting the value. If your apply method does not return a value, the setter will not set the value. The update method (if defined) will also be called when a different value is set. Both the apply and update methods are passed the new value and the old value as params.
本文标签: javascriptExtJS 6 Should I use the config objectStack Overflow
版权声明:本文标题:javascript - ExtJS 6: Should I use the config object? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742260102a2442355.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论