在 ExtJS 5 中我收到控制台警告
[W] Ext.EventManager is deprecated. Use Ext.dom.Element#addListener to attach an event listener.
我正在使用下面的代码语句,
Ext.EventManager.on(window, 'beforeunload', function() {
//code here
});
我知道 Ext.EventManager
已被弃用,但我应该如何替换我的代码语句以在 extjs 5 中使用它?
最佳答案
使用 getWin()
方法并使用 on
附加事件处理程序。
Ext.getWin().on('beforeunload',function(){
//code here
});
其他可能的选择是使用纯 JavaScript。
window.onbeforeunload = function(){
//Code here
};
关于javascript - Ext.EventManager 在 ExtJS 5 中被弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32307990/