This commit is contained in:
JaguarJack 2023-01-13 09:58:11 +08:00
parent 02a4440aa1
commit 1ae53b72e5

View File

@ -6,7 +6,7 @@ import { constantRoutes } from '/admin/router'
import { RouteRecordRaw } from 'vue-router' import { RouteRecordRaw } from 'vue-router'
import { toRaw } from 'vue' import { toRaw } from 'vue'
import { getModuleViewComponents } from '/admin/router/constantRoutes' import { getModuleViewComponents } from '/admin/router/constantRoutes'
const layout = '/admin/layout/index.vue'
interface Permissions { interface Permissions {
menus: Menu[] menus: Menu[]
@ -134,7 +134,7 @@ export const usePermissionsStore = defineStore('PermissionsStore', {
importComponent = viewComponents['/modules' + permission.component] importComponent = viewComponents['/modules' + permission.component]
} }
const menu: Menu = Object.assign({ const menu: Menu = Object.assign({
path: this.resoulveRoutePath(permission.route, path), path: this.resolveRoutePathRoutePath(permission.route, path),
name: permission.module + '_' + permission.permission_mark, name: permission.module + '_' + permission.permission_mark,
component: importComponent, component: importComponent,
redirect: permission.redirect, redirect: permission.redirect,
@ -168,7 +168,7 @@ export const usePermissionsStore = defineStore('PermissionsStore', {
} }
const menu: Menu = Object.assign({ const menu: Menu = Object.assign({
path: this.resoulveRoutePath(route.path, path), path: this.resolveRoutePathRoutePath(route.path, path),
name: route.name, name: route.name,
meta: route.meta, meta: route.meta,
component: route.component, component: route.component,
@ -184,12 +184,12 @@ export const usePermissionsStore = defineStore('PermissionsStore', {
}, },
/** /**
* resoulve route path * resolve path
* @param route * @param route
* @param path * @param path
* @returns * @returns
*/ */
resoulveRoutePath(route: string, path: string): string { resolveRoutePathRoutePath(route: string, path: string): string {
if (path.length) { if (path.length) {
return (path + (route.indexOf('/') === -1 ? '/' : '') + route).replace(/\/$/g, '') return (path + (route.indexOf('/') === -1 ? '/' : '') + route).replace(/\/$/g, '')
} }