Skip to content

Commit 6a2df0a

Browse files
committed
fix: 修复路由children问题
1 parent e914057 commit 6a2df0a

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
1313
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
1414
'max-len': 0,
15+
'no-shadow': 0,
1516
camelcase: 0, // 变量可以用下划线
1617
'no-plusplus': 0, // 禁止使用++,--
1718
'guard-for-in': 0,

src/router/home-router.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import stageConfig from '@/config/stage' // 引入舞台配置
22

3-
console.log('stageConfig', stageConfig)
4-
5-
// 深度遍历配置树, 摘取叶子节点作为路由部分
3+
/**
4+
* 深度遍历配置树, 摘取叶子节点作为路由部分
5+
* @param {*} config 配置项
6+
* @param {*} fuc 回调函数
7+
*/
68
function deepTravel(config, fuc) {
79
if (Array.isArray(config)) {
810
config.forEach(subConfig => {
@@ -19,8 +21,10 @@ function deepTravel(config, fuc) {
1921

2022
const homeRouter = []
2123

24+
/**
25+
* 构造舞台view路由
26+
*/
2227
deepTravel(stageConfig, viewConfig => {
23-
// 构造舞台view路由
2428
const viewRouter = {}
2529
viewRouter.path = viewConfig.route
2630
viewRouter.name = viewConfig.name
@@ -35,6 +39,4 @@ deepTravel(stageConfig, viewConfig => {
3539
homeRouter.push(viewRouter)
3640
})
3741

38-
console.log(homeRouter)
39-
4042
export default homeRouter

src/store/getter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function permissionShaking(stageConfig, permissions, currentUser) {
6565

6666
// 获取有权限的舞台配置
6767
export const permissionStageConfig = state => {
68-
const { stageConfig, permissions, user } = state // eslint-disable-line
68+
const { stageConfig, permissions, user } = state
6969
const tempStageConfig = Util.deepClone(stageConfig)
7070
const shookConfig = permissionShaking(tempStageConfig, permissions, user)
7171

0 commit comments

Comments
 (0)