From b71740f4c12afa0553d21d129051de94e3ce2fbc Mon Sep 17 00:00:00 2001 From: jary Date: Thu, 11 Aug 2022 15:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=88=97=E8=BF=87=E5=A4=9A?= =?UTF-8?q?=E4=B8=94=E6=97=A0=E6=95=B0=E6=8D=AE=E6=97=B6=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BA=95=E9=83=A8=E6=BB=9A=E5=8A=A8=E6=9D=A1=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E4=BE=BF=E6=9F=A5=E7=9C=8B=E6=89=80=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/table.js b/src/modules/table.js index 25cd0f60..1a710d6e 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -790,7 +790,14 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){ } that.setGroupWidth(); - + + // 如果表格内容为空(无数据 或 请求异常) + if (that.layMain.find('tbody').is(":empty")) { + // 将表格宽度设置为跟表头一样的宽度,使之可以出现底部滚动条,以便滚动查看所有字段 + const headerWidth = that.layHeader.first().children('table').width() + that.layMain.find('table').width(headerWidth); + } + that.loading(!0); };