【问题标题】:Load extjs using bootstrap.js from outside of extjs app folder使用 bootstrap.js 从 extjs 应用文件夹外部加载 extjs
【发布时间】:2014-07-24 08:34:38
【问题描述】:

我已经使用 sencha cmd 构建了 extjs 5 应用程序,我想在我的自定义 hmtl 页面中使用它。 我有以下结构:

extjsapp
    .sencha
    app
    build
    ext
    packages
    ......
    bootstrap.js
    bootstrap.json
    app.js
    .......
customapp
    index.html
    script.js

我想做的是在我的 customapp/index.html 中请求 bootstrap.js,它应该从 extjsapp 文件夹加载所有包和 ext。默认情况下,它会尝试从与使用 boostrap.js 的位置相关的 customapp/ext 加载它们。如何制作/构建它,以便它从 extjsapp/ext 而不是 customapp/ext 加载 ext。

应该可以从任何位置使用 bootstrap.js 来加载 extjs 框架和 extjs 文件夹中构建的所有必需的包。

【问题讨论】:

    标签: twitter-bootstrap extjs load customization extjs5


    【解决方案1】:

    app.json 文件中,您将看到有关类路径的条目。这用于告诉 Sencha Cmd 你的源文件在哪里。

    同样在该文件中,您会看到有关 indexHtmlPath 的条目。这说明了 index.html 文件的位置。

    /**
     * Comma-separated string with the paths of directories or files to search. Any classes
     * declared in these locations will be available in your class "requires" or in calls
     * to "Ext.require". The "app.dir" variable below is expanded to the path where the
     * application resides (the same folder in which this file is located).
     */
    "classpath": "${app.dir}/app",
    ...
    /**
     * The file path to this application's front HTML document. This is relative
     * to this app.json file.
     */
    "indexHtmlPath": "index.html",
    

    更改 ExtJS 库的位置涉及编辑隐藏文件 - .sencha/app/sencha.cfg。那里有一个属性 - ext.dir - 你需要更改。

    【讨论】:

    • 我发现 .sencha/workspace/sencha.cfg 中的属性不在 .sencha/app/sencha.cfg 中。改变它是可行的,但它需要相对的路径。自己试试。如果我将其更改为 /extjsapp/ext 它仍将是 bootstrap.json 中的 ext
    • 是的;如果你有一个单应用项目,它在.sencha/app,如果你使用工作区,它在.sencha/workspace
    猜你喜欢
    • 2012-02-27
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 2012-05-02
    • 1970-01-01
    • 1970-01-01
    • 2013-12-22
    • 1970-01-01
    相关资源
    最近更新 更多