Extjs 5.1.1 中的 Ext.i18n.Bundle 中的命名空间无效

Invalid namespace in Ext.i18n.Bundle in Extjs 5.1.1

当使用 ExtJS 5.1 时,我总是得到这个错误:

Uncaught Error: [Ext.ClassManager] Invalid namespace, must be a string  @ext-all-debug.js:8430 
parseNamespace         @ ext-all-debug.js:8430
createNamespaces       @ ext-all-debug.js:8490
(anonymous function)   @ ext-all-debug.js:4450
onBeforeLaunch         @ Bundle.js?_.dc=1476694441934:227
onProfilesReady        @ ext-all-debug.js:54622
constructor            @ ext-all-debug.js:54616
AppTest.$application   @ ext-all-debug.js:7660
(anonymous function)   @ ext-all-debug.js:54856
invoke                 @ ext-all-debug.js:10477
doInvokeAll            @ ext-all-debug.js:10517
invokeAll              @ ext-all-debug.js:10486
unblock                @ ext-all-debug.js:10596
triggerReady           @ ext-all-debug.js:11090
checkReady             @ ext-all-debug.js:11194
load                   @ ext-all-debug.js:10969
require                @ ext-all-debug.js:10882
triggerReady           @ ext-all-debug.js:11065
checkReady             @ ext-all-debug.js:11194
onLoadSuccess          @ ext-all-debug.js:11011
notify                 @ ext-all-debug.js:862
processLoadedEntries   @ ext-all-debug.js:841
notifyRequests         @ ext-all-debug.js:1308
complete               @ ext-all-debug.js:1157
(anonymous function)   @ ext-all-debug.js:1163

好吧,如果你查看堆栈跟踪,你会发现问题似乎在 Bundle.js,第 227 行,因为这是跟踪中提到的第一个非煎茶行:

ns = Ext.namespace(me.name);

如果你尝试

console.log(me.name);

你会发现它是 undefined,因为从 5.0.0 开始,Sencha 越来越倾向于 gettersetter 方法,所以你最好的选择是

console.log(me.getName());