|
@@ -4,6 +4,7 @@ import { AppRouteRecordRaw } from '@/router/types'
|
|
|
import { defineStore } from 'pinia'
|
|
|
// import { sysStaticRouter, noFoundRouters, constantMenuList } from '@/router'
|
|
|
import { getMenuList } from '@/api/system/menu'
|
|
|
+import { HOME_URL } from '@/router'
|
|
|
|
|
|
const modules = import.meta.glob('@/views/**/*.vue')
|
|
|
export const Layout = () => import('@/layout/index.vue') // todo...
|
|
@@ -112,6 +113,7 @@ const getFlatMenuList_1children = (menuList: AppRouteRecordRaw[]) => {
|
|
|
// 过滤隐藏
|
|
|
// const getShowMenuList = (menuList: AppRouteRecordRaw[], parentPath = '') => {
|
|
|
const getShowMenuList = (menuList: AppRouteRecordRaw[]) => {
|
|
|
+ console.error(menuList, 'menuList')
|
|
|
return menuList.filter(item => {
|
|
|
// console.error(item, 'item')
|
|
|
if (!item.meta.hidden) {
|
|
@@ -140,19 +142,15 @@ const usePermissionStore = defineStore({
|
|
|
}),
|
|
|
getters: {
|
|
|
// 有效的 菜单列表
|
|
|
- // showMenuList: state => getShowMenuList(JSON.parse(JSON.stringify([...constantMenuList, ...state.menuList]))),
|
|
|
- showMenuList: state => getShowMenuList(JSON.parse(JSON.stringify(state.menuList))),
|
|
|
- /*getShowMenuList([
|
|
|
- ...JSON.parse(JSON.stringify(state.menuList)),
|
|
|
- // 测试
|
|
|
+ showMenuList: state => {
|
|
|
+ return [
|
|
|
+ // 首页
|
|
|
{
|
|
|
- path: 'dashboard',
|
|
|
- // path: HOME_URL,
|
|
|
- component: () => import('@/views/dashboard/index-old.vue'),
|
|
|
- name: 'dashboard',
|
|
|
+ path: HOME_URL,
|
|
|
meta: { title: 'dashboard', icon: 'icon-homepage', affix: true }
|
|
|
}
|
|
|
- ])*/
|
|
|
+ ].concat(getShowMenuList(JSON.parse(JSON.stringify(state.menuList))))
|
|
|
+ },
|
|
|
// showMenuList: state => getShowMenuList(JSON.parse(JSON.stringify(state.routes)))
|
|
|
// 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由
|
|
|
showMenuListFlat() {
|
|
@@ -188,6 +186,7 @@ const usePermissionStore = defineStore({
|
|
|
data!.menu, // .filter((v: any) => /\/.*/.test(v.path)),
|
|
|
roles
|
|
|
)
|
|
|
+ debugger
|
|
|
this.setRoutes(menuList)
|
|
|
return menuList
|
|
|
})
|