From e180f549c8a2d1796f54c79f77032a224b730b3e Mon Sep 17 00:00:00 2001 From: LH_R Date: Fri, 25 Apr 2025 16:31:43 +0800 Subject: [PATCH] fix(ui): CI - ci detail title display --- .../ciDetailComponent/ciDetailTitle.vue | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailComponent/ciDetailTitle.vue b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailComponent/ciDetailTitle.vue index e58ce80..6824f95 100644 --- a/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailComponent/ciDetailTitle.vue +++ b/cmdb-ui/src/modules/cmdb/views/ci/modules/ciDetailComponent/ciDetailTitle.vue @@ -23,15 +23,25 @@ export default { default: () => [] } }, + data() { + return { + icon: '', + title: '' + } + }, computed: { findCIType() { - return this.ci_types?.find?.((item) => item?.id === this.ci?._type) - }, - icon() { - return this?.findCiType?.icon || '' - }, - title() { - return this?.ci?.[this.findCIType?.show_name] || this?.ci?.[this.findCIType?.unique_key] || '' + return this.ci_types?.find?.((item) => item?.id === this.ci?._type) || {} + } + }, + watch: { + findCIType: { + deep: true, + immediate: true, + handler(val) { + this.icon = val?.icon || '' + this.title = this?.ci?.[val?.show_name] || this?.ci?.[val?.unique_key] || '' + }, } } }