修复两处错误

This commit is contained in:
2025-05-28 08:40:36 +08:00
parent 361d69648e
commit 7b9b72e815
86 changed files with 8 additions and 9 deletions

View File

@ -29,7 +29,7 @@ const toHome = () => router.push({ path: '/' })
<AntDesignOutlined />
<span style="margin-left: 12px">{{ title }}</span>
</div>
<AMenu :items="systemStore.fmtMenus()" mode="inline" theme="dark" @select="selectMenu" />
<AMenu :items="systemStore.fmtMenus" mode="inline" theme="dark" @select="selectMenu" />
</div>
</template>

View File

@ -25,6 +25,13 @@ export const useSystemStore = defineStore('system', {
isLogin(state) {
return !!state.token
},
fmtMenus(state) {
return map(fromArray(toRaw(state.menus), { parentKey: 'parentId' }), (item) => ({
key: item.path || item.value,
label: item.name,
link: item.link || '',
}))
},
},
actions: {
// 解析令牌
@ -54,14 +61,6 @@ export const useSystemStore = defineStore('system', {
axios.get('/manager/own/menus').then(([_, res]) => (this.menus = res.data || []))
}
},
// 格式化菜单
fmtMenus() {
return map(fromArray(toRaw(this.menus), { parentKey: 'parentId' }), (item) => ({
key: item.path || item.value,
label: item.name,
link: item.link || '',
}))
},
// 初始化
init() {
this.parseToken()