该错误可能意味着您在Eathisa.view.login.loginController 和Eathisa.view.override.EathisaViewController 上具有相同的alias 配置。当您尝试通过别名使用它时,对于加载哪个类会有一些歧义,这就是类系统警告您的原因。
根据您的描述,听起来您根本不需要覆盖。如果您需要在所有 ViewController 中添加一些方法,可以将它们添加到自定义 ViewController 中,然后将其用作应用程序中所有其他 ViewController 的基础,而不是 Ext.app.ViewController:
Ext.define('Eathisa.view.AbstractViewController', {
extend: 'Ext.app.ViewController',
// Note that there is no "alias" property here, so that
// this abstract VC can't be instantiated by alias
// You can even make these custom methods excluded from
// production build by enclosing them in the <debug></debug>
// comment brakets:
//<debug>
methodFoo: function() {
...
}
//</debug>
});
Ext.define('Eathisa.view.login.LoginController', {
extend: 'Eathisa.view.AbstractViewController',
alias: 'controller.login',
methodThatUsesFoo: function() {
// Just don't forget to enclose the code that *calls*
// debug-only methods in the same <debug> brackets
//<debug>
this.methodFoo();
//</debug>
...
}
});
如果从同一个抽象 VC 扩展所有 ViewController 不可行,请改为在 mixin 中实现自定义方法,并将该 mixin 包含在需要调试方法的 VC 中:
Ext.define('Eathisa.mixin.Debug', {
methodFoo: function() {
...
}
});
Ext.define('Eathisa.view.login.LoginController', {
extend: 'Ext.app.ViewController',
alias: 'controller.login',
// Conditionally include the debugging mixin
//<debug>
mixins: [
'Eathisa.mixin.Debug'
],
//</debug>
...
});