如何在类中创建静态字段,然后在Sencha Touch 2中从该类之外访问它们?在Sencha Touch中访问静态属性
例如,我创建了一个简单单用一个静态:
Ext.define('App.util.Config', {
singleton: true,
statics: {
url: {
USER: 'http://localhost:3436/api/user'
}
},
config: { },
constructor: function (config) {
this.initConfig(config);
this.callParent([config]);
}
});
使用我不能访问用户字段App.util.Config.url.USER但App.util.Config .self.url.USER。看着在煎茶文档样本,看来我应该能够能够访问前一种方法的领域:
See Statics Section in this link and how they access the Computer.InstanceCount field
对我工作的罚款。是否App.util.Config.url未定义? App.util.Config.self返回什么? –
App.util.Config.url \t'undefined' App.util.Config.self \t'函数(){ \t返回this.constructor.apply(此,自变量); \t}' App.util.Config.self.url.USER \t'的 “http://本地主机:3436/API /用户”' – Nate
另外一个资料片,可能是相关的,我不是'分机。创建(...)这个类,但是在app.js中需要它:[ 'Ext.MessageBox', 'App.data.ConnectionRouter', 'App.util.Config' ] – Nate