From e2d79ce1efff01885c29c07f02efb86c39d13dff Mon Sep 17 00:00:00 2001 From: u2nyakim Date: Wed, 27 Aug 2025 18:00:37 +0800 Subject: [PATCH] up. --- .../components/request-record-detail.vue | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/z_ele/src/views/system/request-record/components/request-record-detail.vue b/z_ele/src/views/system/request-record/components/request-record-detail.vue index 4e74a2f..e2f0d42 100644 --- a/z_ele/src/views/system/request-record/components/request-record-detail.vue +++ b/z_ele/src/views/system/request-record/components/request-record-detail.vue @@ -145,18 +145,21 @@ */ function formatJson(jsonString, indentSpaces = 2) { // 验证输入是否为字符串 - if (typeof jsonString !== 'string') { - throw new Error('输入必须是字符串'); - } // 解析JSON字符串为JavaScript对象 let parsedObj; - try { - parsedObj = JSON.parse(jsonString); - } catch (e) { - throw new Error('无效的JSON格式: ' + e.message); + if (typeof jsonString === 'string') { + // throw new Error('输入必须是字符串'); + try { + parsedObj = JSON.parse(jsonString); + } catch (e) { + throw new Error('无效的JSON格式: ' + e.message); + } + }else{ + parsedObj = jsonString; } + // 递归函数来处理格式化 function format(obj, depth) { // 处理基本类型