1.mixins
Description: Similar to multi-inheritance in object-oriented
<script type= "Text/javascript" >
Ext.onready (function () {
Create a class, class name: Textclass, with two properties: A, B
Ext.define (' Textclass ', {
A: ' A ',
B: ' B '
});
Create a class, class name: Textclass, with two properties: A, B
Ext.define (' TextClass2 ', {
C: ' C ',
Write:function () {
Alert (' A: ' + this. A + '; B: ' + this. B + '; C: ' + this. C
}
})
Ext.define (' TextClass3 ', {
Inherit Textclass, TextClass2
Mixins: {
Textclass: ' Textclass ',
TextClass2: ' TextClass2 '
}
})
var textclass = ext.create ("TEXTCLASS3")
Textclass.write ();
});
</script>
Operation Result:
2.statics
Description: Defining static variables
Example:
<script type= "Text/javascript" >
Ext.onready (function () {
Create a class, class name: Textclass, with two properties: A, B
Ext.define (' Textclass ', {
A: ' A ',
B: ' B ',
Statics: {
C: ' C '
}
});
No instantiation of the Textclass class
Ext.Msg.alert (the value of the static property C of the ' Textclass class is: ', TEXTCLASS.C)
});
</script>
Execution Result:
3.config
Description: Property wrapper, providing a get and set method for a property
Example:
<script type= "Text/javascript" >
Ext.onready (function () {
Create a class, class name: Textclass, with two properties: A, B
Ext.define (' Textclass ', {
A: ' A ',
B: ' B ',
Statics: {
C: ' C '
},
Config: {
Configproperty: ' How can I get the property '
}
});
var textclass = ext.create (' Textclass ');
Set the value of the property by the Set method, note that the wrapper will capitalize the first letter of the property
Textclass.setconfigproperty ("Set this property ' s value");
Displaying property values through the Get method
Ext.Msg.alert (the value of the ' Configproperty attribute is: ', Textclass.getconfigproperty ());
});
</script>
Execution Result:
3.ext.require
Description: Dynamic Loading JS file
Using Ext.require to load the JS file, first set the file path through Ext.loader.
Example:
<script type= "Text/javascript" >
Set the JS file folder under the Ext namespace
Ext.Loader.setPath ({
EXT: ' Http://www.cnblogs.com/Scripts/ext-4.0.7-gpl/ext-4.0.7-gpl/src '
});
Ext.onready (function () {
Load the Ext.window.MessageBox class, located in the Http://www.cnblogs.com/Scripts/ext-4.0.7-gpl/ext-4.0.7-gpl/src/window/MessageBox.js file
Note: A JS file has only one class
Note: Class name = namespace name (This is EXT) + file path name (this is Window/messagebox)
Ext.require ("Ext.window.MessageBox")
});
</script>
Execution Result:
EXTJS4 Self-Study manual--ext Basic Methods, attributes (Mixins multiple inheritance, statics, require)