From 12201e065fe575761995440a3bf1e9876321c6e6 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Thu, 14 Nov 2024 18:13:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 10680f6..3330753 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -1,4 +1,4 @@ -import { isArray } from '@/utils/is' +import { isArray, isNumber } from '@/utils/is' import { FieldNamesProps } from '@/components/ProTable/interface' const mode = import.meta.env.VITE_ROUTER_MODE @@ -239,7 +239,8 @@ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNa export function formatTableColumn(row: number, col: number, callValue: any) { // 如果当前值为数组,使用 / 拼接(根据需求自定义) if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' - return (callValue && callValue.length > 0) ? callValue : '/' + if (isNumber(callValue)) return callValue + return callValue ?? "/"; } /** @@ -250,7 +251,8 @@ export function formatTableColumn(row: number, col: number, callValue: any) { export function formatValue(callValue: any) { // 如果当前值为数组,使用 / 拼接(根据需求自定义) if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/' - return (callValue && callValue.length > 0) ? callValue : '/' + if (isNumber(callValue)) return callValue + return callValue ?? "/"; } /**