Skip to content

Commit

Permalink
判断当前路由类型 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
daxiongYang committed Sep 13, 2018
1 parent 909c8f1 commit 393c284
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ router.beforeEach((to, from, next) => {
// 添加动态(菜单)路由
// 1. 已经添加 or 全局路由, 直接访问
// 2. 获取菜单列表, 添加并保存本地存储
if (router.options.isAddDynamicMenuRoutes || fnCurrentRouteType(to) === 'global') {
if (router.options.isAddDynamicMenuRoutes || fnCurrentRouteType(to, globalRoutes) === 'global') {
next()
} else {
http({
Expand Down Expand Up @@ -89,7 +89,7 @@ router.beforeEach((to, from, next) => {
* 判断当前路由类型, global: 全局路由, main: 主入口路由
* @param {*} route 当前路由
*/
function fnCurrentRouteType (route) {
function fnCurrentRouteType (route, globalRoutes = []) {
var temp = []
for (var i = 0; i < globalRoutes.length; i++) {
if (route.path === globalRoutes[i].path) {
Expand Down

0 comments on commit 393c284

Please # to comment.