From 15bcbd44b6a3b2ec34092bc5ed3e213fa9c55de4 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期三, 20 十二月 2023 16:14:56 +0800 Subject: [PATCH] 将侧栏菜单数据存储进vuex --- src/router/index.js | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 9cbc146..7718b21 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,7 @@ import warehouseManageRouter from "./warehouseManage/index.js" // 浠撳簱绠$悊 import reportRouter from "./report/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) @@ -130,6 +131,8 @@ }; const foundObject = res.data.list.find(obj => obj.systemType === 3); if (foundObject) { + // 瀛樺偍杩泇uex + store.commit('setMenus', foundObject.menus); foundObject.menus.forEach(item => { const nextPath = item.children.find(obj => obj.path === routePath); if (nextPath) { -- Gitblit v1.8.0