feat: 优化前端代码
This commit is contained in:
parent
521f32dce0
commit
dc0c86fcc2
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu class="w-28">
|
||||
<el-dropdown-item> <Icon name="user" /> <router-link :to="{ name: 'user-center' }"> 个人信息</router-link> </el-dropdown-item>
|
||||
<el-dropdown-item> <Icon name="user" /> <router-link :to="{ path: 'center' }"> 个人信息</router-link> </el-dropdown-item>
|
||||
<el-dropdown-item divided @click="logout">
|
||||
<Icon name="power" className="mr-1 w-4 h-4" />
|
||||
退 出
|
||||
|
@ -38,6 +38,7 @@ const guard = (router: Router) => {
|
||||
const permissionStore = usePermissionsStore()
|
||||
// 动态路由挂载
|
||||
const asyncRoutes = permissionStore.getAsyncMenusFrom(toRaw(userStore.getPermissions))
|
||||
console.log(asyncRoutes)
|
||||
asyncRoutes.forEach((route: Menu) => {
|
||||
router.addRoute(route as unknown as RouteRecordRaw)
|
||||
})
|
||||
|
@ -191,7 +191,7 @@ export const usePermissionsStore = defineStore('PermissionsStore', {
|
||||
*/
|
||||
resolveRoutePathRoutePath(route: string, path: string): string {
|
||||
if (path.length) {
|
||||
return (path + (route.indexOf('/') === -1 ? '/' : '') + route).replace(/\/$/g, '')
|
||||
return (path + (!route.startsWith('/') ? '/' : '') + route).replace(/\/$/g, '')
|
||||
}
|
||||
|
||||
// 去除尾部的 /
|
||||
|
Loading…
x
Reference in New Issue
Block a user