Ext JS - 如何从 ViewModel 中获取应用程序的名称?

2 javascript extjs extjs5

我的邪恶博士应用程序name定义为DrEvil

Ext.define('DrEvil.Application', {
    extend: 'Ext.app.Application',

    name: 'DrEvil',

    stores: [
        // TODO: add global / shared stores here
    ],

    launch: function () {
        // TODO - Launch the application
    }
});
Run Code Online (Sandbox Code Playgroud)

在我的视图模型中,有没有办法检索这个名字?我希望类似的东西能把Ext.app.name它拉起来,但它却是空的。我一直在遍历等的属性ExtExt.app但似乎找不到它。

这可能是一件非常微不足道的事情,以至于它看起来就像我的脸,但我确实在谷歌 N 种ExtJS变体中获取了视图模型中的应用程序名称,但没有任何相关内容出现。

我正试图说服该公司购买 ExtJS 的 Eclipse 插件!大概可以在一秒钟内回答这个问题。

Yim*_*ong 5

如果您假设不了解该应用程序,则实际上根本不明显。

这是通用代码,可以执行您想要的操作:

var name = Ext.app.Application.instance.getName();

或者在最新版本的 ExtJS 中:

var name = Ext.getApplication().getName();