Ext. Extend plays a major role in extjs and is one of several important functions in extjs. To gain a deeper understanding of extjs, this function must be mastered. There are a lot of source code analysis and introduction to this function on the Internet. The usage of this function is as follows.
Function Base (config ){ This . Name = Config. Name ; This . Age = config. Age; This . Sex = config. Sex ;} Function Base (config ){ This . Identity = config. identity; This . MSG = config. MSG;This . Phone = config. Phone; base. superclass. Constructor . Call ( This , Config);} Ext. Extend (base, base, {showmsg: Function (){ Window . Alert ( This . Name + ''+ This . Age + ''+ This . Sex + ''+ This . Identity + ''+ This . MSG + ''+ This . Phone );}});
In this case
-
-
The second case is
FunctionBase (config ){This.Name= Config.Name;This. Age = config. Age;This. Sex = config. Sex ;}
VaRBase = ext. Extend (base, {showmsg:Function(){Window.Alert(This.Name+ ''+This. Age + ''+This. Sex + ''+This. Identity + ''+This. MSG + ''+This. Phone );}}
WhenVaRMybase =NewBase (/**/); The base constructor function will be called.
Case 3
function base (config) { This . name = config. name ; This . age = config. age; This . sex = config. sex ;}
VaRBase = ext. Extend ({Constructor:Function(Config ){This. Identity = config. identity;This. MSG = config. MSG;This. Phone = config. Phone;}, showmsg:Function(){Window.Alert(This.Name+ ''+This. Age + ''+This. Sex + ''+This. Identity + ''+This. MSG + ''+This. Phone );}}
In this case VaR Mybase = New Base ( /**/ ); The constructor function passed in Ext. Extend will be called to analyze all three cases used by Ext. Extend. the inheritance system in extjs is constructed based on the above three cases. Article There are few text descriptions in. If you have read some text and do not know how to solve it, You can first analyze the Ext. Extend function source code, debug it several times, and then look back, it is estimated that you will understand the meaning of the article at once. The balsamiq software is used for drawing.