From 466c02773f34e2c9c659719db5f0b10ca83484ec Mon Sep 17 00:00:00 2001 From: Jasery Date: Fri, 31 Oct 2025 18:00:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(HeaderLayout):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=89=88=E6=9C=AC=E6=98=BE=E7=A4=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在头部布局中添加从主进程获取应用版本号并显示的功能,当获取失败时显示'unknown' --- .../components/layout/HeaderLayout.vue | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/renderer/components/layout/HeaderLayout.vue b/src/renderer/components/layout/HeaderLayout.vue index 0df88a9..9ac1221 100644 --- a/src/renderer/components/layout/HeaderLayout.vue +++ b/src/renderer/components/layout/HeaderLayout.vue @@ -22,35 +22,45 @@ const headerMenus: { text: string path: string }[] = [ - { - icon: mdiHome, - text: 'title.main', - path: '/' - }, - { - icon: mdiFitToScreenOutline, - text: 'title.second', - path: '/second' - } - ] + { + icon: mdiHome, + text: 'title.main', + path: '/' + }, + { + icon: mdiFitToScreenOutline, + text: 'title.second', + path: '/second' + } +] + +// Get app version +const appVersion = ref('') + +onMounted(async () => { + try { + appVersion.value = await window.mainApi.invoke('msgRequestGetVersion') + } catch (error) { + console.error('Failed to get app version:', error) + appVersion.value = 'unknown' + } +})