Commit d55ca3aa by 姜雷

添加静态路由方法以及扩展白名单参数

parent a15a203b
......@@ -24,16 +24,25 @@ class SystemShell {
this.mixinModule = mixinModule;
this.utils = utilsModule;
}
createSystem = ({ basePath = '/', routers, routeFilter }) => {
createSystem = ({
basePath = '/',
routers,
routeFilter,
constantRouter,
whiteList,
}) => {
const router = new VueRouter({
mode: 'history',
base: basePath,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap,
routes:
constantRouter && constantRouter instanceof Array
? [...constantRouterMap, ...constantRouter]
: constantRouterMap,
});
routeStore.install(store);
extendCom(Vue);
configRoutePermission(router, store, routers);
configRoutePermission(router, store, routers, whiteList);
Vue.config.productionTip = false;
let app = new Vue({
......
......@@ -4,10 +4,21 @@ import 'nprogress/nprogress.css'; // Progress 进度条样式
import { getToken } from '@/utils/auth'; // 验权
import { getAuthRoute } from '../utils/route';
const configRoutePermission = (router, store, allAasyncRouterMap) => {
const configRoutePermission = (
router,
store,
allAasyncRouterMap,
addwhiteList
) => {
NProgress.configure({ showSpinner: false }); // NProgress Configuration
const whiteList = process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单
const whiteList =
addwhiteList && typeof addwhiteList === 'string'
? [
...process.env.VUE_APP_WHITE_LIST.split(','),
...addwhiteList.split(','),
]
: process.env.VUE_APP_WHITE_LIST.split(','); // 不重定向白名单
const getRouteAdd = () => {
let allRoute = store.getters.asyncRoutes;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment