当我按下回车键
时,这不起作用var loginContent = new ContentPane({
id: 'lgncontent',
content: loginboxes,
onKeyPress: loginKeyPress
});
function loginKeyPress(evt) {
require(["dojo/keys", "dojo/dom", "dojo/on"], function (keys, dom, on) {
on(dom.byId("lgncontent"), "keypress", function (evt) {
switch (evt.charOrCode) {
case keys.ENTER:
console.log('ENTER!');
sendCred(lForm.getValues());
break;
}
});
});
}
答案 0 :(得分:1)
解决 而不是函数,我必须在dlg定义后添加以下行:
var btnClick = dlg._onKey = function(evt) {
key = evt.keyCode;
if (key == dojo.keys.ENTER) {
sendCred(lForm.getValues());
}
}