layui中,解决按钮太多,展示不全,点击无效问题

1 在数据表格上,操作按钮太多的时候,页面展示不全,下拉显示所有按钮时,点击无效。需要在js中添加代码,放在layui.use()里面即可。

$(document).off('mousedown', '.layui-table-grid-down')
                .on('mousedown', '.layui-table-grid-down', function (event) {
                    table._tableTrCurr = $(this).closest('td');
                });

            $(document).off('click', '.layui-table-tips-main [lay-event]')
                .on('click', '.layui-table-tips-main [lay-event]', function (event) {
                    var elem = $(this);
                    var tableTrCurr = table._tableTrCurr;
                    if (!tableTrCurr) {
                        return;
                    }
                    var layerIndex = elem.closest('.layui-table-tips').attr('times');
                    // 关闭当前这个显示更多的tip
                    layer.close(layerIndex);
                    table._tableTrCurr.find('[lay-event="' + elem.attr('lay-event') + '"]').first().click();
                });

猜你喜欢

转载自blog.csdn.net/zhang123csdn/article/details/130980949