From 74f6fd717362b8e151be2a54d0f5087f2ad26689 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Tue, 16 May 2023 14:44:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE=E4=B8=8D=E8=87=AA=E5=8A=A8=E4=BC=B8?= =?UTF-8?q?=E7=BC=A9=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nladmin-ui/src/utils/nladmin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nladmin-ui/src/utils/nladmin.js b/nladmin-ui/src/utils/nladmin.js index 371bcb1..fb347e6 100644 --- a/nladmin-ui/src/utils/nladmin.js +++ b/nladmin-ui/src/utils/nladmin.js @@ -234,14 +234,14 @@ export async function blobValidate(data) { * 注:prop,title有一个必传 */ export function flexWidth(prop, tableData, title, num = 0) { - if (tableData.length === 0) { // 表格没数据不做处理 - return - } let flexWidth = 0// 初始化表格列宽 let columnContent = ''// 占位最宽的内容 const canvas = document.createElement('canvas') const context = canvas.getContext('2d') context.font = '14px Microsoft YaHei' + if (tableData.length === 0) { // 表格没数据不做处理 + return context.measureText(title).width + 20 + num + 'px' + } // 获取占位最宽的内容 let index = 0 for (let i = 0; i < tableData.length; i++) { // 循环表格内容,获取表格内容中最长的数据