From 38527c6a41b62a16e944e5d243b0f1ce14817e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Wed, 15 Nov 2023 11:41:23 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=B8=B2=E6=9F=93=E5=8D=A1?= =?UTF-8?q?=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Cards/DetailCard/ItemValue.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/Cards/DetailCard/ItemValue.vue b/src/components/Cards/DetailCard/ItemValue.vue index 2e88db709..74e323f63 100644 --- a/src/components/Cards/DetailCard/ItemValue.vue +++ b/src/components/Cards/DetailCard/ItemValue.vue @@ -18,9 +18,7 @@ export default { } }, data() { - return { - formatterData: '' - } + return {} }, computed: { displayValue() { @@ -69,19 +67,18 @@ export default { } }, render(h) { + let formatterData = '' if (typeof this.formatter === 'function') { const data = this.formatter(this.item, this.value) if (data instanceof Promise) { data.then(res => { - this.formatterData = res + formatterData = res }) } else { - if (data instanceof Object && data.hasOwnProperty('componentOptions')) { - this.formatterData = h(data.componentOptions.tag, data.componentOptions.children) - } + this.formatterData = data } return ( - {this.formatterData} + {formatterData} ) } if (this.value instanceof Array) {