ExtJS 6 视图自动加载器问题

ExtJS 6 view autoloader issue

ExtJS 6.5.0:在应用程序中使用它

appFolder: '/app/document/app'

但它看起来不适用于视图:

>> Ext.Loader.getPath('Document');
/app/document/app

>> Ext.Loader.getPath('Document.view.main.Main');
classic/src/view/main/Main.js
{OR} modern/src/view/main/Main.js
// Expected:
// /app/document/app/classic/src/view/main/Main.js
// OR /app/document/app/modern/src/view/main/Main.js

>> Ext.Loader.getPath('Document.main.Main');
/app/document/app/main/Main.js

有人可以为此提出解决方案吗?


重现问题的步骤:

sencha generate workspace ./
sencha framework add ~/extjs/6.5.0 ext
sencha -sdk ext generate app Document ./app/document

nano ./app/document/app.js
> + appFolder: '/app/documents/app',

将索引文件向上移动两个文件夹...打开控制台并从顶部检查命令。


P.S。我在 Ext.beforeLoad 中进行了破解以解决它,但我需要直接解决方案 "out of the box"

我认为您已经创建了一个 Universal 应用程序。

Universal 应用程序有两个单独的文件夹用于 classicmodern 视图。

EXTJS 6 将在 classicmodern 文件夹中获取相应类型的所有视图文件,并且它将根据您的加载描述符在 运行 时间加载视图。你可以在 运行 时间给予。

Ext.manifest = 'classic' or 'modern';

这是 https://www.sencha.com/forum/showthread.php?269448-Cmd-3-1-2-Ext-Loader-path-prefix 的方法:

To dynamically load the assets from other than the page-location's context, without using the base tag I think one really does have to mess with the loader configuration. Something like:

Code:

Ext.Loader.setPath({
    "Ext":              "http://path/ext/src",
    "MyApp":            "http://path/app",
    "MyApp.model":      "http://path/app/model",
    "MyApp.view":       "http://path/app/view",
    "MyApp.controller": "http://path/app/controller",
    "MyApp.store":      "http://path/app/store",
    "MyApp.extras":     "http://path/app/extras"

});

The namespace needs to be "over-specified" because Ext.application will trash the autoloader's MyApp path by overriding it with the value of MyApp.appFolder (which is really not supposed to be an absolute path; even Architect won't allow you to set one.)