Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs 如何使用';覆盖';Sencha cmd为Ext JS 4项目生成的文件夹_Extjs_Extjs4 - Fatal编程技术网

Extjs 如何使用';覆盖';Sencha cmd为Ext JS 4项目生成的文件夹

Extjs 如何使用';覆盖';Sencha cmd为Ext JS 4项目生成的文件夹,extjs,extjs4,Extjs,Extjs4,我已经使用senchacmd生成了一个项目。这将创建一个名为“overrides”的好文件夹,我将覆盖的Ext.Ajax类放在这个文件夹中。然后,我会像这样将其包含在app.js文件中 requires: [ 'overrides.Ajax' ] 这在使用我的应用程序时效果很好,但是当我尝试使用Sencha cmd构建它时,会出现以下错误: [ERR] BUILD FAILED [ERR] com.sencha.exceptions.BasicException: The follow

我已经使用senchacmd生成了一个项目。这将创建一个名为“overrides”的好文件夹,我将覆盖的Ext.Ajax类放在这个文件夹中。然后,我会像这样将其包含在app.js文件中

requires: [
    'overrides.Ajax'
]
这在使用我的应用程序时效果很好,但是当我尝试使用Sencha cmd构建它时,会出现以下错误:

[ERR] BUILD FAILED
[ERR] com.sencha.exceptions.BasicException: The following error occurred while e
xecuting this line:
[ERR] Z:\public_html\LoginScreen\.sencha\app\build-impl.xml:469: com.sencha.exce
ptions.ExBuild: com.sencha.exceptions.ExBuild: Failed to find any files for Z:\p
ublic_html\LoginScreen\app\app.js::ClassRequire::overrides.Ajax

有人知道如何正确地包含覆盖文件夹中的文件吗?

您可能需要在加载程序配置中为覆盖定义路径

大概是这样的:

Ext.Loader.setConfig({
    paths: {
        'Ext.ux': 'js/extjs/ux',
        'overrides' : 'somepath/to/overrides',
        'Skirtle.CTemplate':'js/extjs/ux/SkirtleCTemplate.js' //<-- specific component
    }
});
Ext.Loader.setConfig({
路径:{
“Ext.ux”:“js/extjs/ux”,
“覆盖”:“somepath/to/overrides”,

'Skirtle.CTemplate':'js/extjs/ux/SkirtleCTemplate.js'/结果表明,我需要编辑.sencha/app/sencha.cfg文件,在app.classpath的末尾添加以下内容

,${app.dir}/overrides
感谢Mitchell在Sencha官方论坛上对我的帮助!

对我来说,只有

requires: [
    'overrides.Ajax'
]
没用,我得补充一句

requires: [
    'MyApp.overrides.Ajax'
]
它成功了:)

还有vars

// @require @packageOverrides
// @require @appOverrides
不要为我做任何事,所以步骤很简单

  • sencha.cfg
  • 将requires添加到
    app.js
    中的
    Ext.application

  • 在Sencha Cmd v4.0.2.67中测试,对于Ext 5用户,您可以在app.json中指定“覆盖文件夹”。示例:

    "overrides": "${app.dir}/overrides",
    

    很好的建议,但我的问题似乎不是这样。由于'overrides'文件夹出现在'app'和'ext'旁边,我在路径中添加了'overrides':'overrides',但似乎没有帮助。非常感谢。这对我很有效。我不知道他们为什么忽略sencha.cfg文件中的“app.classpath”属性。在ext 6中,默认值缺少${app.dir}”值