简体   繁体   English

extjs 文件放在哪里?

[英]Where to put extjs file?

I came across the extjs class on GitHub that I would like to use in my application.我在GitHub上遇到了我想在我的应用程序中使用的 extjs class。 Where should I put that file?我应该把那个文件放在哪里?

I know that file structure in extjs follows some patterns, so for example if the name of my application is MyApp, then I put classes in corresponding folders, like MyApp.view.myfolder.MyClass .我知道 extjs 中的文件结构遵循一些模式,例如,如果我的应用程序的名称是 MyApp,那么我将类放在相应的文件夹中,例如MyApp.view.myfolder.MyClass

However, in this case the usage of class is given as但是,在这种情况下,class 的用法为

GLC.tip.toast(title, message, options)

so I doubt that I should put it in some view folder.所以我怀疑我应该把它放在某个视图文件夹中。 On the other hand I tried to copy those two files (glc_tip.js and tip.scss) in the root folder of my application and include in index.html the following line:另一方面,我尝试将这两个文件(glc_tip.js 和 tip.scss)复制到我的应用程序的根文件夹中,并在 index.html 中包含以下行:

<script type="text/javascript" src="glc_tip.js"/>

but it also doesn't work.但它也不起作用。 I got an error that it is not defined.我收到一个错误,它没有定义。

UPDATE更新

I created folder /ux/tip/ in the application root directory and put files toast.js (renamed glc_tip.js) and tip.scss into it.我在应用程序根目录中创建了文件夹 /ux/tip/ 并将文件 toast.js(重命名为 glc_tip.js)和 tip.scss 放入其中。 After that I modified app.json, so the section with "js" and "css" looks like:之后我修改了app.json,所以带有“js”和“css”的部分看起来像:

"js": [{
    "path": "app.js",
    "bundle": true
},{
    "path": "/ux/tip/toast.js",
    "bundle": true
}],
"css": [{
    // This entry uses an ant variable that is the calculated value of the generated
    // output css file for the app, defined in .sencha/app/defaults.properties
    "path": "${build.out.css.path}",
    "bundle": true,
    "exclude": ["fashion"]
},{
    "path": "/ux/tip/tip.scss"
}],

After that I did sencha app refresh and sencha app build development , but it still doesn't work.之后我做了sencha app refreshsencha app build development ,但还是不行。 i am getting an error:我收到一个错误:

Uncaught ReferenceError: GLC is not defined at constructor.handler未捕获的 ReferenceError:GLC 未在 constructor.handler 中定义

It is better to register the third party libs in 'app.json' file.最好在“app.json”文件中注册第三方库。 There must be js and css sections.必须有js和css部分。 You can put it in '/ux/tip/toast.js' file (create dirs if they do not exist).您可以将它放在“/ux/tip/toast.js”文件中(如果目录不存在则创建)。

Js files in js文件在

"js": [
    {
        "path": "${framework.dir}/build/ext-all-rtl-debug.js"
    },
    {
        "path": "app.js",
        "bundle": true
    }
],

CSS files will be registered in CSS 文件将注册在

"css": [
    {
        // this entry uses an ant variable that is the calculated
        // value of the generated output css file for the app,
        // defined in .sencha/app/defaults.properties
        "path": "${build.out.css.path}",
        "bundle": true,
        "exclude": ["fashion"]
    }
],

And do not forget to rebuild and refresh your project to apply changes.并且不要忘记重建和刷新您的项目以应用更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM