我想在我的页面添加热键功能。
Ext.onReady(function () {
Ext.util.KeyMap(document, {
key: 'abc',
handler: function () {
alert("Hotkey was pressed!");
}
});
});
但事件不会发生。
答案 0 :(得分:4)
Ext 3.3.1:
Ext.onReady(function () {
new Ext.KeyMap(document, {
key: 'abc',
fn: function () {
alert("Hotkey was pressed!");
}
});
});
Ext 4.0.2.a中的:
Ext.onReady(function () {
var map = new Ext.util.KeyMap(document,{
//key : "abc" //doesn't work (mybe a bug)
key: [65,66,67], // this works,
fn: function(){ alert('a, b or c was pressed'); }
}
);
});
答案 1 :(得分:2)
使用fn
密钥,而不是handler
参数