src/router/index.js
@@ -6,6 +6,7 @@
import purchaseRouter from "./purchase/index.js"
import productRouter from "./product/index.js"
import {getMenuTreeByRole} from "@/api/menus/index"
import store from '@/store/index.js';
Vue.use(Router)
const login = (resolve) => require(["@/views/other/login/index"], resolve)
@@ -100,7 +101,7 @@
// 导出路由 在 main.js 里使用
const createRouter = () =>
  new Router({
    mode: "history",
    mode: "hash",
    // base: window.getServerJson.context,
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
@@ -118,6 +119,8 @@
    };
    const foundObject = res.data.list.find(obj => obj.systemType === 4);
    if (foundObject) {
      // 存储进vuex
      store.commit('setMenus', foundObject);
      foundObject.menus.forEach(item => {
        const nextPath = item.children.find(obj => obj.path === routePath);
        if (nextPath) {