简体   繁体   中英

Error in my first ExtJs 6 application. Ext.app is undefined

I am new to ExtJs. I have create sample ExtJs app and I am getting error 'Ext.app is undefined' in the console. I am not getting desired output on the screen.

Following is my app.js file and HTML file:

 Ext.application({ name: 'HelloWorld', launch: function () { console.log('App created'); } } ) 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script language="javascript" type="text/javascript" src="Scripts/ext-debug.js"></script> <script language="javascript" src="app/app.js" type="text/javascript"></script> <link href="Styles/extjs.css" type="text/css" rel="stylesheet" /> </head> <body> </body> </html> 

Following is the image of project

在此处输入图片说明

The ext-debug.js script only includes the types under the root Ext namespace. Try including ext-all-debug.js instead.

<script language="javascript" type="text/javascript" src="Scripts/ext-all-debug.js"></script>

Try requiring Ext.app.Application as per for the following forum thread.

https://www.sencha.com/forum/showthread.php?304087-ext-debug-receiving-Ext-app-setupPaths-undefined-Full-source-debugging

Ext.require([
    'Ext.app.Application'
], function() {
    Ext.application({
        ...
    });
});

you need to reference the framework's bootstrap.js (while in debug mode) in order the have Ext.Loader (aka the mini-loader) available; after compiling, it's source code + framework concatenated into a single file. loading the pre-built ext-all.js or ext-all-debug.js is not exactly how this framework works (despite it may solve your problem); better use SenchaCmd , else you'd be lost with dependencies easily. here would be one example (mine) for an ExtJS project; eg. see the Application.js and compare that to the live example's application.js , to see what I mean.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM