Commit dd1a6886 authored by Sendya's avatar Sendya

feat: add openOnceKey control open root menu feat.

parent b7eb4a7c
......@@ -140,7 +140,7 @@ export default {
| i18nRender | i18n | Function (key: string) => string \| `false` | `false` |
| handleMediaQuery | media matchs callback | (querys: []) => void | - |
| mediaQuery | media matchs | Array | - |
| openOnceKey | menu only open root key | `true` | - |
### PageHeaderWrapper
......
......@@ -137,7 +137,7 @@ export default {
| i18nRender | 本地化渲染函数 (this.$t) | Function (key: string) => string \| `false` | `false` |
| handleMediaQuery | 媒体查询回调 | (querys: []) => void | - |
| mediaQuery | ProLayout 当前的媒体查询 | Array | - |
| openOnceKey | Menu菜单最多只打开一个 | `true` | - |
### PageHeaderWrapper
......
{
"name": "@ant-design-vue/pro-layout",
"version": "1.0.8",
"version": "1.0.9",
"main": "./lib/index.js",
"module": "./es/index.js",
"repository": {
......
......@@ -96,7 +96,6 @@ const RouteMenu = {
render (h, ctx) {
const { mode, theme, menus, i18nRender, openOnceKey } = this
const handleOpenChange = (openKeys) => {
// 在水平模式下时,不再执行后续
if (mode === 'horizontal') {
this.sOpenKeys = openKeys
......@@ -156,6 +155,9 @@ const RouteMenu = {
item.path && openKeys.push(item.path)
})
}
if (!this.openOnceKey) {
this.sOpenKeys.forEach(item => openKeys.push(item))
}
this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.sOpenKeys = openKeys)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment