本文介绍了从extjs应用程序文件夹外部使用bootstrap.js加载extjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have built extjs 5 app using sencha cmd and I want to use it in my custom hmtl page.I have the following structure:

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

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

What I want to do is in my customapp/index.html I request bootstrap.js and it should load all packages and ext from extjsapp folder. By default it tries to load them from customapp/ext which is relative to where boostrap.js is used. How can I make/build it so that it will load ext from extjsapp/ext instead of customapp/ext.

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

It should be possible to use bootstrap.js from any location to load extjs framework and all required packages that are built in extjs folder.

推荐答案

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

In the app.json file, you'll see an entry about the classpath. This is used to tell Sencha Cmd where your source files are.

在该文件中,您还将看到有关indexHtmlPath的条目.这说明index.html文件在哪里.

Also in that file, you'll see an entry about the indexHtmlPath. This says where the index.html file is.

/**
 * 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-您需要更改.

Changing where the ExtJS library is involves editing a hidden file - .sencha/app/sencha.cfg. There's a property in there - ext.dir - that you need to change.

这篇关于从extjs应用程序文件夹外部使用bootstrap.js加载extjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 09:02