【发布时间】:2014-05-21 08:47:09
【问题描述】:
由于某种原因,Sencha Cmd 在使用自定义代码解析 app.js 时失败。下面是我正在部署到测试(未缩小的 JavaScript,但在单个文件中)或生产(缩小的 JavaScript)的应用程序的 sn-p。
浏览器从已部署的文件夹(带有 all-classes.js)中抛出以下 JavaScript 异常:
(注意:所有js源代码的文件夹运行良好)
GET http://localhost/App/App/model/app/CheckTreeNode.js?_dc=1396967410158 404 (Not Found) all-classes.js:10841
GET http://localhost/App/App/store/app/UserPreferenceNodes.js?_dc=1396967410159 404 (Not Found) all-classes.js:10841
GET http://localhost/App/app/controller/ViewportAdmin.js?_dc=1396967410177 404 (Not Found) all-classes.js:10841
...
Uncaught Error: [Ext.Loader] Failed loading 'App/model/app/CheckTreeNode.js', please verify that the file exists all-classes.js:11259
Uncaught Error: [Ext.Loader] Failed loading 'App/store/app/UserPreferenceNodes.js', please verify that the file exists all-classes.js:11259
Uncaught Error: [Ext.Loader] Failed loading 'app/controller/ViewportAdmin.js', please verify that the file exists
我尝试通过在我的 Ext.application 类中添加“需要”配置来解决问题,但这并没有帮助。如何强制 Sencha Cmd 看到这些文件? Sencha Touch 有一个解决方案,允许您将文件添加到“app.json”。也许我不知道的 ExtJS 应用程序有类似的解决方案?
如果有更优雅的解决方案,我愿意接受。我需要我的一堆类的构造函数中的用户首选项,所以这是我可以加载它并在调用它们时准备好的唯一地方。如果在 MVC 中构建类时有不同的方式来加载可用的数据,那么我可以使用不同的解决方案。至于有两个视口,这是我发现的工作,所以这就是 ViewportAdmin 是什么。只是第二个视口。
app.js 源代码:
Ext.应用程序({ 名称:'应用程序',
extend: 'App.Application',
requires: [
'App.store.app.UserPreferences',
'App.view.ViewportAdmin'
],
autoCreateViewport: false,
launch: function () {
Ext.StoreManager.lookup('App.store.app.UserPreferences').on('load', function () {
if (window.location.href.indexOf('/App/index.aspx?admin=true') > -1) {
Ext.create('App.view.ViewportAdmin');
}
else if (window.location.href.indexOf('/App/index.aspx') > -1) {
Ext.create('App.view.Viewport');
}
});
}
});
【问题讨论】:
标签: javascript extjs extjs4 sencha-cmd