From 0a59c4578cb5fa953fb11f6e6cdada4b07baacfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Wed, 21 May 2025 11:13:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E4=BC=98=E5=8C=96=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 改进了当前角色的显示逻辑,增加了对 userInfo.roleNames 的空值检查- 如果 roleNames 为空,将显示 '未指定',提高了代码的健壮性和用户体验 --- src/views/app/Home.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/app/Home.vue b/src/views/app/Home.vue index 5f82c20..bbb01f6 100644 --- a/src/views/app/Home.vue +++ b/src/views/app/Home.vue @@ -6,7 +6,9 @@ 你好,{{ userInfo.realName }}
欢迎使用{{ title }}
- 当前角色:{{ userInfo.roleNames[0] || '未指定' }} + 当前角色:{{ + userInfo.roleNames ? userInfo.roleNames[0] : '未指定' + }}