Commit 3b4d2c11 by 姜雷

修改处理路由方式并添加处理方法

parent 2ea0ddae
......@@ -36,7 +36,6 @@ class SystemShell {
extendCom(Vue);
configRoutePermission(router, store, routers);
Vue.config.productionTip = false;
console.log(router);
let app = new Vue({
el: '#app',
......@@ -46,16 +45,9 @@ class SystemShell {
let routes = [...constantRouterMap];
let allRoute = store.getters.asyncRoutes;
if (typeof routeFilter === 'function') {
allRoute = routeFilter(allRoute);
}
if (allRoute && allRoute.length) {
let addRoute = formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
const data = routeFilter(routes, allRoute);
routes = data.routes;
allRoute = data.allRoute;
}
return <App route={routes} allRoutes={allRoute} />;
},
......
import * as main from '../utils/index';
import * as auth from '../utils/auth';
import * as route from '../utils/route';
import downloadUrl from '../utils/download';
import { getYourIP } from '../utils/getIp';
import * as validate from '../utils/validate';
......@@ -7,6 +8,7 @@ import * as validate from '../utils/validate';
export default {
...main,
auth,
route,
downloadFiles: downloadUrl,
getIp: getYourIP,
validate,
......
import System from './lib/main';
console.log(System);
let allAasyncRouterMap = [
...customerManage.default,
...baseManage.default,
......@@ -11,4 +9,19 @@ let allAasyncRouterMap = [
System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap,
routeFilter: (routes, allRoute) => {
if (allRoute && allRoute.length) {
let addRoute = System.utils.route.formatRouteLink(allRoute);
for (let index = 0; index < addRoute.length; index++) {
const element = addRoute[index];
if (element.children) {
routes = routes.concat(element.children);
}
}
}
return {
allRoute,
routes,
};
},
});
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