extjs的Ext.define()函数的用法以及注意点。
2016-10-14 16:33
423 查看
译自:http://docs.sencha.com/extjs/4.2.3/#!/api/Ext
define( className,
data, [createdFn] ) : Ext.Base
Defines a class or override. A basic class is defined like this:
className : String
The class name to create in string dot-namespaced format, for example: 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager' It is highly recommended to follow this simple convention: - The root and the class name are 'CamelCased' - Everything else is lower-cased
Pass
data : Object
The key - value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved listed below: -
-
createdFn : Function (optional)
Callback to execute after the class is created, the execution scope of which (
created class itself.
Ext.Base
注意:参数集中的data选项的key值(数据名)是有限制的,如下关键字不可用:
data : Object
The key - value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved listed below: -
-
-
define( className,
data, [createdFn] ) : Ext.Base
Defines a class or override. A basic class is defined like this:
Ext.define('My.awesome.Class', { someProperty: 'something', someMethod: function(s) { alert(s + this.someProperty); } ... }); var obj = new My.awesome.Class(); obj.someMethod('Say '); // alerts 'Say something'
Parameters
className : StringThe class name to create in string dot-namespaced format, for example: 'My.very.awesome.Class', 'FeedViewer.plugin.CoolPager' It is highly recommended to follow this simple convention: - The root and the class name are 'CamelCased' - Everything else is lower-cased
Pass
nullto create an anonymous class.
data : Object
The key - value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved listed below: -
mixins-
statics-
config-
alias-
xtype(for Components only)
-
self-
singleton-
alternateClassName-
override
createdFn : Function (optional)
Callback to execute after the class is created, the execution scope of which (
this) will be the newly
created class itself.
Returns
Ext.Base注意:参数集中的data选项的key值(数据名)是有限制的,如下关键字不可用:
data : Object
The key - value pairs of properties to apply to this class. Property names can be of any valid strings, except those in the reserved listed below: -
mixins-
statics-
config-
alias-
xtype(for Components only)
-
self-
singleton-
alternateClassName-
override
即:
- mixins
-statics-
config-
alias-
xtype(for Components only)
-
self-
singleton-
alternateClassName-
override
当然还包括其子类的属性和所有类的基类Ext.Base的所有属性,比如Ext.Base.extend
即如extend:'Ext.tree.Panel',
这些关键字不可用,因为这些key值被赋予了特殊的意义,具体参考官网说明。
相关文章推荐
- Extjs Ext.ux.IFrame的用法 以及父子窗口间函数相互调用
- 深入php define()函数以及defined()函数的用法详解
- 深入php define()函数以及defined()函数的用法详解
- fread 和 fwrite 函数用法示例以及注意事项
- innerText innerHTML的用法以及注意事项 [推荐]
- Windows API函数之PlaySound函数以及sndPlaySound函数用法总结
- EXTJS学习系列基础篇:第六篇(转载)作者殷良胜,Ext组件系列之--button组件的基本用法
- EXTJS学习系列基础篇:第七篇(转载)作者殷良胜,Ext组件系列之--label组件的基本用法
- srand()以及rand()函数用法
- 多线程CreateThread函数的用法及注意事项
- innerText,innerHTML的用法以及注意事项
- EXTJS学习系列基础篇:第八篇(转载)作者殷良胜,Ext组件系列之--textfield组件的基本用法
- Ext.extend用法以及代码解读
- EXTJS学习系列基础篇:第八篇(转载)作者殷良胜,Ext组件系列之--textfield组件的基本用法
- new与delete函数使用方法以及注意事项
- innerText,innerHTML的用法以及注意事项
- PHP中不被注意但是比较重要的函数用法集合
- Ext.extend用法以及代码解读
- EXTJS学习系列基础篇:第八篇(转载)作者殷良胜,Ext组件系列之--textfield组件的基本用法
- EXTJS学习系列基础篇:第九篇(转载)作者殷良胜,Ext组件系列之--field组件的基本用法