Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

点侧边栏展开父级别菜单展开或者伸缩的时候 其他菜单一起伸缩 不是单个伸缩或者展开 #2367

Open
tiantian998 opened this issue Jul 11, 2019 · 5 comments

Comments

@tiantian998
Copy link

tiantian998 commented Jul 11, 2019

点侧边栏展开击父级别菜单展开或者伸缩的时候 其他菜单一起伸缩 不是单个伸缩或者展开
:unique-opened="false" 或者 :unique-opened="true" 都没有用

Screenshot or Gif(截图或动态图)

image
image
image
而且点击顶部收缩菜单后 点击展示不出全部对应的菜单

我的后台编写 Sidebar.vue 页面

自己编写的SidebarItem.vue

image
image
登陆的时候分配菜单
image
store获取菜单
image
image

动态生成菜单的方法
export function filterAsyncRouter(asyncRouterMap) {
// 注意这里的 asyncRouterMap 是一个数组
const accessedRouters = asyncRouterMap.filter(route => {
if (route.path) {
if (route.path === '-') {
// Layout组件特殊处理
route.component = Layout
route.path = ''
} else {
try {
route.component = _import(route.path)
} catch (e) {
console.info('%c 当前路由 ' + route.path + '.vue 不存在,因此如法导入组件,请检查接口数据和组件是否匹配,并重新登录,清空缓存!', 'color:red')
}
}
}
if (route.children && route.children.length) {
route.children = filterAsyncRouter(route.children)
}
return true
})

return accessedRouters
}

我自己生成的菜单json格式
[{
"id": 2,
"pid": 0,
"order": 0,
"name": "系统管理",
"hidden": false,
"path": "-",
"meta": {
"title": "系统管理",
"icon": "component",
"requireAuth": true,
"NoTabPage": false
},
"children": [{
"id": 3,
"pid": 2,
"order": 1,
"name": "用户管理",
"hidden": false,
"path": "/users/index",
"meta": {
"title": "用户管理",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 6,
"pid": 2,
"order": 2,
"name": "角色管理",
"hidden": false,
"path": "/roles/index",
"meta": {
"title": "角色管理",
"icon": null,
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 1030,
"pid": 2,
"order": 3,
"name": "组织机构",
"hidden": false,
"path": "/organizations/index",
"meta": {
"title": "组织机构",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 8,
"pid": 2,
"order": 4,
"name": "接口管理",
"hidden": false,
"path": "/modules/index",
"meta": {
"title": "接口管理",
"icon": null,
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 26,
"pid": 2,
"order": 5,
"name": "图标管理",
"hidden": false,
"path": "/icons/index",
"meta": {
"title": "图标管理",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 15,
"pid": 2,
"order": 6,
"name": "菜单管理",
"hidden": false,
"path": "/permission/index",
"meta": {
"title": "菜单管理",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 16,
"pid": 2,
"order": 7,
"name": "分配权限",
"hidden": false,
"path": "/permission/assign",
"meta": {
"title": "分配权限",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}]
}, {
"id": 1040,
"pid": 0,
"order": 0,
"name": "产品管理",
"hidden": false,
"path": "-",
"meta": {
"title": "产品管理",
"icon": "component",
"requireAuth": true,
"NoTabPage": false
},
"children": [{
"id": 1042,
"pid": 1040,
"order": 0,
"name": "sdsdfdfssdf",
"hidden": false,
"path": "/category/index",
"meta": {
"title": "sdsdfdfssdf",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}, {
"id": 1043,
"pid": 1040,
"order": 0,
"name": "sfsdfsdfsdfsdf",
"hidden": false,
"path": "/categoy/index",
"meta": {
"title": "sfsdfsdfsdfsdf",
"icon": "",
"requireAuth": true,
"NoTabPage": false
},
"children": null
}]
}]

@tiantian998 tiantian998 changed the title 伸缩 点侧边栏展开击父级别菜单展开或者伸缩的时候 其他菜单一起伸缩 不是单个伸缩或者展开 Jul 11, 2019
@tiantian998 tiantian998 changed the title 点侧边栏展开击父级别菜单展开或者伸缩的时候 其他菜单一起伸缩 不是单个伸缩或者展开 点侧边栏展开父级别菜单展开或者伸缩的时候 其他菜单一起伸缩 不是单个伸缩或者展开 Jul 11, 2019
@tiantian998
Copy link
Author

希望得到解决

@297087852
Copy link

直觉告诉我 sidebarItem写的有问题吧 看不到 sidebarItem html

@tiantian998
Copy link
Author

tiantian998 commented Jul 17, 2019 via email

@tiantian998
Copy link
Author

tiantian998 commented Jul 17, 2019 via email

@wsq-wushiqi
Copy link

请问是如何解决的?可以分享一下吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants