Abh*_*uke 2 javascript extjs extjs4 extjs5
在ExtJS 5中,我收到控制台警告说
[W]不推荐使用Ext.EventManager.使用Ext.dom.Element#addListener附加事件侦听器.
我正在使用代码声明,
Ext.EventManager.on(window, 'beforeunload', function() {
//code here
});
Run Code Online (Sandbox Code Playgroud)
我明白这Ext.EventManager已被弃用,但我应该如何替换我的代码语句以在extjs 5中使用它?
使用getWin()方法并使用附加事件处理程序on.
Ext.getWin().on('beforeunload',function(){
//code here
});
Run Code Online (Sandbox Code Playgroud)
其他可能的选择是使用纯JavaScript.
window.onbeforeunload = function(){
//Code here
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1322 次 |
| 最近记录: |