ext4 require加载文件之后怎么实例化

<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

  ext4  新引用了require这个异步加载机制,但是我用require引用了俩个需要加载的子类的时候,不能通过create去实例化,请问各位大神有没有什么好的解决办法尴尬,代码如下 :

//(function(){
Ext.Loader.setConfig({
			enabled : true,
			paths : {
				'myApp' : 'js/myApp' //配置路径
			}
		});
/*Ext.require('myApp.view.tree.tabPanels'
 // , 'myApp.view.tree.myTreePanelView'
 );*/
//var tabPanel=Ext.create('myApp.view.tree.tabPanels',{});
//var treePanelView=Ext.create('myApp.view.tree.myTreePanelView',{});
/*	 var tabPanel=Ext.create('js.testjs.commonjs.tabPanels',{
 title:'this my new Panel'
 });*/
/*Ext.Loader.setPath('myApp', 'js/myApp');
 Ext.require('myApp.view.tree.indexPage');*/
Ext.onReady(function() {
	Ext.QuickTips.init();

	// NOTE: This is an example showing simple state management. During
	// development,
	// it is generally best to disable state management as dynamically-generated
	// ids
	// can change across page loads, leading to unpredictable results. The
	// developer
	// should ensure that stable state ids are set for stateful components in
	// real apps.
	Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));

	Ext.create('Ext.Viewport', {
		/*Ext.define('myApp.view.tree.indexPage',{
		 extend   : 'Ext.Viewport',*/
		uses : ['myApp.view.tree.myTreePanelView', 'myApp.view.tree.tabPanels'],
		id : 'border-example',
		layout : 'border',
		items : [
				// create instance immediately
				Ext.create('Ext.Component', {
							region : 'north',
							height : 50, // give north and south regions a
							// height
							autoEl : {
								tag : 'div',
								html : '<p><h3>金智万维软件系统</h3></p>',
								bodyStyle : 'background:#ffc; padding:10px;'
							}
						}), {
					// lazily created panel (xtype:'panel' is default)
					region : 'south',
					contentEl : 'south',
					split : true,
					height : 100,
					minSize : 100,
					maxSize : 200,
					collapsible : true,
					collapsed : true,
					title : 'South',
					margins : '0 0 0 0'
				}, {
					xtype : 'tabpanel',
					region : 'east',
					title : 'East Side',
					dockedItems : [{
								dock : 'top',
								xtype : 'toolbar',
								items : ['->', {
											xtype : 'button',
											text : 'test',
											tooltip : 'Test Button'
										}]
							}],
					animCollapse : true,
					collapsible : true,
					split : true,
					width : 225, // give east and west regions a width
					minSize : 175,
					maxSize : 400,
					margins : '0 5 0 0',
					activeTab : 1,
					tabPosition : 'bottom',
					items : [{
								html : '<p>A TabPanel component can be a region.</p>',
								title : 'A Tab',
								autoScroll : true
							}, Ext.create('Ext.grid.PropertyGrid', {
										title : 'Property Grid',
										closable : true,
										source : {
											"(name)" : "Properties Grid",
											"grouping" : false,
											"autoFitColumns" : true,
											"productionQuality" : false,
											"created" : Ext.Date.parse(
													'10/15/2006', 'm/d/Y'),
											"tested" : false,
											"version" : 0.01,
											"borderWidth" : 1
										}
									})]
				}, {
					region : 'west',
					stateId : 'navigation-panel',
					id : 'west-panel', // see Ext.getCmp() below
					title : '导航-ERP管理',
					split : true,
					width : 200,
					minWidth : 175,
					maxWidth : 400,
					collapsible : true,
					animCollapse : true,
					margins : '0 0 0 5',
					layout : 'accordion'
					//items : [treePanelView]
			}	, this.tabPanel
		/*{
		//title:'this is myPanel',
		region: 'center', // a center region is ALWAYS required for border layout
		id:'center-tab',
		deferredRender: false,
		activeTab: 0,     // first tab initially active
		resizeEl: 'center-iframe'
		// items:[myFirstPanal]
		}*/]
		,
			initComponent:function(){
			//var treePanelView=Ext.create('myApp.view.tree.myTreePanelView',{});
			debugger
			 var tabPanel=Ext.create('myApp.view.tree.tabPanels');
			 this.callParent();
		}
			//renderTo: Ext.getBody()   //渲染到页面
	});
		// get a reference to the HTML element with id "hideit" and add a click
		// listener to it
		// alert("hello world!!")
});
//Ext.create('myApp.view.tree.indexPage',{})
//})();
 

 myTreePanelView和tabPanels  是俩个define的类文件   可以引入但是不能实例化

弄了俩天还是出不来 ,求大神帮忙啊

你可能感兴趣的:(js,ext,require,ext4)