我想为ExtJS应用程序中使用的所有其他控制器创建一个基本ViewController。
问题是ExtJs正在/ classic / src / view中寻找基类而不是/ app / view ....
这是一个例子: in /app/view/base/BaseController.js
Ext.define('myApp.view.base.BaseController', {
extend: 'Ext.app.ViewController',
doStuff: function(msg) {
alert(msg);
}
});
/ app/view/another/AnotherController.js中的
Ext.define('myApp.view.another.AnotherController', {
extend: 'myApp.view.base.BaseController',
onButtonClick: function() {
doStuff('Button clicked');
}
});
在/app/classic/src/view/another/Another.js
Ext.define('myApp.view.another.Another', {
extend: 'Ext.panel.Panel',
xtype: 'another',
alias: 'view.another',
id: 'panel_another',
controller: 'another',
items: [{
xtype: 'button',
text: 'The Button',
handler: onButtonClick
}]
});
然而,当我运行应用程序时,ExtJs会抛出错误,说没有找到/classic/src/view/base/BaseController.js!
我在这里做错了什么?
感谢您的时间和帮助!
答案 0 :(得分:1)
您只需尝试按sencha app build
构建应用。它将解决此问题。
答案 1 :(得分:0)
是的,同意上述答案。您还可以执行 sencha app refresh 。您可以在DEV模式下尝试此操作。请尝试此操作。