Commit 200f6159 by fengshuonan

弹框增加对esc键的监听

parent 1fb33cda
......@@ -58,7 +58,7 @@ layui.define(['jquery', 'layer', 'admin', 'table'], function (exports) {
layer.closeAll('tips');
admin.getTempData('formOk') && table.reload(param.tableId);
if(param.endCallback){
if (param.endCallback) {
admin.getTempData('formOk') && param.endCallback();
}
......@@ -66,7 +66,17 @@ layui.define(['jquery', 'layer', 'admin', 'table'], function (exports) {
param.fixed = false;
param.resize = false;
param.shade = .1;
return top.layui.layer.open(param);
var thisIndex = top.layui.layer.open(param);
//按键监听esc关闭对话框
$(window).keydown(function (event) {
if (event.keyCode === 27) {
parent.layer.close(thisIndex)
}
});
return thisIndex;
}
};
......
......@@ -75,5 +75,22 @@ ${layoutContent}
<script src="${item}?v=${constants.getReleaseVersion()}"></script>
@}
@}
<script>
/**
* 按键监听esc
*/
layui.use(['admin'], function () {
var admin = layui.admin;
var $ = layui.jquery;
$(window).keydown(function (event) {
if (event.keyCode === 27) {
admin.closeThisDialog();
}
});
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment