diff --git a/src/views/dashboard/related/log/LogTable/LogDetail.vue b/src/views/dashboard/related/log/LogTable/LogDetail.vue index 91dcb965..6d4cc704 100644 --- a/src/views/dashboard/related/log/LogTable/LogDetail.vue +++ b/src/views/dashboard/related/log/LogTable/LogDetail.vue @@ -23,7 +23,7 @@ limitations under the License. --> class="content mb-10" :readonly="true" v-else-if="item.label === 'content'" - :value="currentLog[item.label]" + :value="contentFormat(item.label)" />
{{ d }}
@@ -38,6 +38,7 @@ limitations under the License. --> import { useI18n } from "vue-i18n"; import type { Option } from "@/types/app"; import { dateFormat } from "@/utils/dateFormat"; + import { formatJson } from "@/utils/formatJson"; /*global defineProps */ const props = defineProps({ @@ -53,6 +54,16 @@ limitations under the License. --> return `${d.key} = ${d.value}`; }); }); + + function contentFormat(label: string) { + try { + return props.currentLog.contentType === "JSON" + ? formatJson(JSON.parse(props.currentLog[label])) + : props.currentLog[label]; + } catch (e) { + return props.currentLog[label]; + } + }