Commit 2ea0ddae by 姜雷

添加基本地址配置

parent 8901c98b
import 'normalize.css/normalize.css'; import 'normalize.css/normalize.css';
import App from '../App'; import App from '../App';
import router, { constantRouterMap, routeStore } from '../router'; import { constantRouterMap, routeStore } from '../router';
import store from '../store'; import store from '../store';
import createBaseFetch from './Api'; import createBaseFetch from './Api';
import configRoutePermission from './permission'; import configRoutePermission from './permission';
...@@ -25,11 +25,18 @@ class SystemShell { ...@@ -25,11 +25,18 @@ class SystemShell {
this.mixinModule = mixinModule; this.mixinModule = mixinModule;
this.utils = utilsModule; this.utils = utilsModule;
} }
createSystem = ({ routers, routeFilter }) => { createSystem = ({ basePath = '/', routers, routeFilter }) => {
const router = new VueRouter({
mode: 'history',
base: basePath,
scrollBehavior: () => ({ y: 0 }),
routes: constantRouterMap,
});
routeStore.install(store); routeStore.install(store);
extendCom(Vue); extendCom(Vue);
configRoutePermission(router, store, routers); configRoutePermission(router, store, routers);
Vue.config.productionTip = false; Vue.config.productionTip = false;
console.log(router);
let app = new Vue({ let app = new Vue({
el: '#app', el: '#app',
......
...@@ -9,5 +9,6 @@ let allAasyncRouterMap = [ ...@@ -9,5 +9,6 @@ let allAasyncRouterMap = [
]; ];
System.createSystem({ System.createSystem({
basePath: process.env.VUE_APP_BASE_URL,
routers: allAasyncRouterMap, routers: allAasyncRouterMap,
}); });
...@@ -33,9 +33,8 @@ const asyncRouterMap = [{ path: '*', redirect: '/404', hidden: true }]; ...@@ -33,9 +33,8 @@ const asyncRouterMap = [{ path: '*', redirect: '/404', hidden: true }];
export { constantRouterMap, asyncRouterMap, routeStore }; export { constantRouterMap, asyncRouterMap, routeStore };
export default new VueRouter({ export default {
mode: 'history', constantRouterMap,
base: process.env.VUE_APP_BASE_URL, asyncRouterMap,
scrollBehavior: () => ({ y: 0 }), routeStore,
routes: constantRouterMap, };
});
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