Ext.create
Posted xssystem
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ext.create相关的知识,希望对你有一定的参考价值。
create: function() { var name = arguments[0], nameType = typeof name, args = arraySlice.call(arguments, 1), cls; if (nameType === ‘function‘) { cls = name; } else { if (nameType !== ‘string‘ && args.length === 0) { args = [ name ]; if (!(name = name.xclass)) { name = args[0].xtype; if (name) { name = ‘widget.‘ + name; } } } if (typeof name !== ‘string‘ || name.length < 1) { throw new Error("[Ext.create] Invalid class name or alias ‘" + name + "‘ specified, must be a non-empty string"); } name = Manager.resolveName(name); cls = Manager.get(name); } // Still not existing at this point, try to load it via synchronous mode as the last resort if (!cls) { Ext.log.warn("[Ext.Loader] Synchronously loading ‘" + name + "‘; consider adding " + "Ext.require(‘" + name + "‘) above Ext.onReady"); Ext.syncRequire(name); cls = Manager.get(name); } if (!cls) { throw new Error("[Ext.create] Unrecognized class name / alias: " + name); } if (typeof cls !== ‘function‘) { throw new Error("[Ext.create] Singleton ‘" + name + "‘ cannot be instantiated."); } return Manager.getInstantiator(args.length)(cls, args); },
以上是关于Ext.create的主要内容,如果未能解决你的问题,请参考以下文章
SenCha Touch 中的 Ext.create() 和 Ext.define() 有啥区别
js中Ext.create()是啥东西 ? 有啥作用?求解答
ExtJS使用Ext.create( [String name], [Object... args] ) : Object实例化类