From 16734b1d88bdab94516ec1f43833017d8cf8d821 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期三, 24 十一月 2021 15:03:04 +0800
Subject: [PATCH] 升级velocity到最新版本2.3
---
ruoyi-ui/src/store/modules/permission.js | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js
index 61f681c..2c2120a 100644
--- a/ruoyi-ui/src/store/modules/permission.js
+++ b/ruoyi-ui/src/store/modules/permission.js
@@ -1,12 +1,15 @@
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
-import ParentView from '@/components/ParentView';
+import ParentView from '@/components/ParentView'
+import InnerLink from '@/layout/components/InnerLink'
const permission = {
state: {
routes: [],
addRoutes: [],
+ defaultRoutes: [],
+ topbarRouters: [],
sidebarRouters: []
},
mutations: {
@@ -14,8 +17,19 @@
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
},
- SET_SIDEBAR_ROUTERS: (state, routers) => {
- state.sidebarRouters = constantRoutes.concat(routers)
+ SET_DEFAULT_ROUTES: (state, routes) => {
+ state.defaultRoutes = constantRoutes.concat(routes)
+ },
+ SET_TOPBAR_ROUTES: (state, routes) => {
+ // 椤堕儴瀵艰埅鑿滃崟榛樿娣诲姞缁熻鎶ヨ〃鏍忔寚鍚戦椤�
+ const index = [{
+ path: 'index',
+ meta: { title: '缁熻鎶ヨ〃', icon: 'dashboard' }
+ }]
+ state.topbarRouters = routes.concat(index);
+ },
+ SET_SIDEBAR_ROUTERS: (state, routes) => {
+ state.sidebarRouters = routes
},
},
actions: {
@@ -30,7 +44,9 @@
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
commit('SET_ROUTES', rewriteRoutes)
- commit('SET_SIDEBAR_ROUTERS', sidebarRoutes)
+ commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
+ commit('SET_DEFAULT_ROUTES', sidebarRoutes)
+ commit('SET_TOPBAR_ROUTES', sidebarRoutes)
resolve(rewriteRoutes)
})
})
@@ -50,6 +66,8 @@
route.component = Layout
} else if (route.component === 'ParentView') {
route.component = ParentView
+ } else if (route.component === 'InnerLink') {
+ route.component = InnerLink
} else {
route.component = loadView(route.component)
}
@@ -68,7 +86,7 @@
var children = []
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
- if (el.component === 'ParentView') {
+ if (el.component === 'ParentView' && !lastRouter) {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
if (c.children && c.children.length) {
@@ -88,8 +106,13 @@
return children
}
-export const loadView = (view) => { // 璺敱鎳掑姞杞�
- return (resolve) => require([`@/views/${view}`], resolve)
+export const loadView = (view) => {
+ if (process.env.NODE_ENV === 'development') {
+ return (resolve) => require([`@/views/${view}`], resolve)
+ } else {
+ // 浣跨敤 import 瀹炵幇鐢熶骇鐜鐨勮矾鐢辨噿鍔犺浇
+ return () => import(`@/views/${view}`)
+ }
}
export default permission
--
Gitblit v1.9.3