From 477fd5164eb4708a9bce0e9fd3b5700f96c3bc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Wed, 1 Mar 2023 16:03:32 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableFormatters/HostInfoFormatter.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/TableFormatters/HostInfoFormatter.vue b/src/components/TableFormatters/HostInfoFormatter.vue index 4aa1cf38b..0f908992d 100644 --- a/src/components/TableFormatters/HostInfoFormatter.vue +++ b/src/components/TableFormatters/HostInfoFormatter.vue @@ -43,7 +43,8 @@ export default { }, items() { const cellValue = { ...this.cellValue } - cellValue['memory'] = (this.cellValue['memory'] / 1 || 0).toFixed(2) + const memory = this.cellValue?.memory + cellValue['memory'] = memory ? (memory / 1 || 0).toFixed(2) : '-' return cellValue }, viewText() { @@ -65,8 +66,8 @@ export default { async optionAndGenFields() { const data = await this.$store.dispatch('common/getUrlMeta', { url: this.url }) const remoteMeta = data.actions['GET'] || {} - const fieldName = this.formatterArgs.fieldName - const remoteMetaFields = remoteMeta[fieldName].children + const fieldName = this.formatterArgs?.fieldName || '' + const remoteMetaFields = remoteMeta[fieldName]?.children || {} const fields = Object.keys(remoteMetaFields) const info = {} for (const name of fields) {