layer绑定enter键

function showSureDialog() {
    let index = layer.open({
        skin: "demo-class1",
        btn: ['确定','取消'],
        yes: function(index, layero){
            deleteFile(index)
        },
        title: "确认信息",
        area: ["315px", "160px"],
        content: "执行后不可恢复,确定删除此文件吗?",
    //    ++enter
        success: function(layero, index){
            $(document).on('keydown', function(e){  //document为当前元素,限制范围,如果不限制的话会一直有事件
                if(e.keyCode == 13){
                    deleteFile(index);
                }
            })
        }
    //    ++
    });
}

你可能感兴趣的:(css框架)