mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-04-06 03:57:54 +08:00
style(store): modify package
This commit is contained in:
parent
ebe4861163
commit
564ffd2ddd
@ -31,8 +31,6 @@
|
|||||||
"./src/**/*.{vue,js,jsx,ts,tsx,json}": "eslint --fix"
|
"./src/**/*.{vue,js,jsx,ts,tsx,json}": "eslint --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/crypto-js": "^4.1.1",
|
|
||||||
"@types/qs": "^6.9.7",
|
|
||||||
"@vueuse/core": "^9.10.0",
|
"@vueuse/core": "^9.10.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
@ -52,8 +50,10 @@
|
|||||||
"@commitlint/config-conventional": "^17.4.0",
|
"@commitlint/config-conventional": "^17.4.0",
|
||||||
"@iconify-json/icon-park-outline": "^1.1.9",
|
"@iconify-json/icon-park-outline": "^1.1.9",
|
||||||
"@iconify/vue": "^4.0.2",
|
"@iconify/vue": "^4.0.2",
|
||||||
|
"@types/crypto-js": "^4.1.1",
|
||||||
"@types/mockjs": "^1.0.7",
|
"@types/mockjs": "^1.0.7",
|
||||||
"@types/node": "^18.11.18",
|
"@types/node": "^18.11.18",
|
||||||
|
"@types/qs": "^6.9.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
||||||
"@typescript-eslint/parser": "^5.48.1",
|
"@typescript-eslint/parser": "^5.48.1",
|
||||||
"@unocss/preset-attributify": "^0.48.3",
|
"@unocss/preset-attributify": "^0.48.3",
|
||||||
|
@ -76,27 +76,6 @@ export const useRouteStore = defineStore('route-store', {
|
|||||||
this.userRoutes = userRoutes;
|
this.userRoutes = userRoutes;
|
||||||
this.menus = this.transformAuthRoutesToMenus(userRoutes);
|
this.menus = this.transformAuthRoutesToMenus(userRoutes);
|
||||||
},
|
},
|
||||||
/* 初始化动态路由 */
|
|
||||||
async initDynamicRoute() {
|
|
||||||
// 根据用户id来获取用户的路由
|
|
||||||
const { userId } = getUserInfo();
|
|
||||||
const { data: routes } = await fetchUserRoutes({ userId });
|
|
||||||
// 根据用户返回的路由表来生成真实路由
|
|
||||||
const appRoutes = await createDynamicRoutes(routes);
|
|
||||||
// 生成侧边菜单
|
|
||||||
await this.createMenus(routes);
|
|
||||||
// 插入路由表
|
|
||||||
router.addRoute(appRoutes);
|
|
||||||
},
|
|
||||||
/* 初始化静态路由 */
|
|
||||||
async initStaticRoute() {
|
|
||||||
// 根据静态路由表来生成真实路由
|
|
||||||
const appRoutes = await createDynamicRoutes(staticRoutes);
|
|
||||||
// 生成侧边菜单
|
|
||||||
await this.createMenus(staticRoutes);
|
|
||||||
// 插入路由表
|
|
||||||
router.addRoute(appRoutes);
|
|
||||||
},
|
|
||||||
//* 将返回的路由表渲染成侧边栏 */
|
//* 将返回的路由表渲染成侧边栏 */
|
||||||
transformAuthRoutesToMenus(userRoutes: AppRoute.Route[]): MenuOption[] {
|
transformAuthRoutesToMenus(userRoutes: AppRoute.Route[]): MenuOption[] {
|
||||||
return userRoutes
|
return userRoutes
|
||||||
@ -123,6 +102,28 @@ export const useRouteStore = defineStore('route-store', {
|
|||||||
return target;
|
return target;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/* 初始化动态路由 */
|
||||||
|
async initDynamicRoute() {
|
||||||
|
// 根据用户id来获取用户的路由
|
||||||
|
const { userId } = getUserInfo();
|
||||||
|
const { data: routes } = await fetchUserRoutes({ userId });
|
||||||
|
// 根据用户返回的路由表来生成真实路由
|
||||||
|
const appRoutes = await createDynamicRoutes(routes);
|
||||||
|
// 生成侧边菜单
|
||||||
|
await this.createMenus(routes);
|
||||||
|
// 插入路由表
|
||||||
|
router.addRoute(appRoutes);
|
||||||
|
},
|
||||||
|
/* 初始化静态路由 */
|
||||||
|
async initStaticRoute() {
|
||||||
|
// 根据静态路由表来生成真实路由
|
||||||
|
const appRoutes = await createDynamicRoutes(staticRoutes);
|
||||||
|
// 生成侧边菜单
|
||||||
|
await this.createMenus(staticRoutes);
|
||||||
|
// 插入路由表
|
||||||
|
router.addRoute(appRoutes);
|
||||||
|
},
|
||||||
|
|
||||||
async initAuthRoute() {
|
async initAuthRoute() {
|
||||||
this.isInitAuthRoute = false;
|
this.isInitAuthRoute = false;
|
||||||
if (this.authRouteMode === 'dynamic') {
|
if (this.authRouteMode === 'dynamic') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user