Commit 750db02a authored by Sendya's avatar Sendya

fix: openKeys deep error vueComponent/ant-design-vue-pro/issues/1271

parent dd1a6886
{ {
"name": "@ant-design-vue/pro-layout", "name": "@ant-design-vue/pro-layout",
"version": "1.0.9", "version": "1.0.10",
"main": "./lib/index.js", "main": "./lib/index.js",
"module": "./es/index.js", "module": "./es/index.js",
"repository": { "repository": {
......
...@@ -101,12 +101,8 @@ const RouteMenu = { ...@@ -101,12 +101,8 @@ const RouteMenu = {
this.sOpenKeys = openKeys this.sOpenKeys = openKeys
return return
} }
const latestOpenKey = openKeys.find(key => !this.sOpenKeys.includes(key)) // const latestOpenKey = openKeys.find(key => !this.sOpenKeys.includes(key))
if (!openOnceKey) { this.sOpenKeys = openKeys
this.sOpenKeys = openKeys
} else {
this.sOpenKeys = latestOpenKey ? [latestOpenKey] : []
}
this.$emit('openChange', openKeys) this.$emit('openChange', openKeys)
} }
...@@ -156,8 +152,10 @@ const RouteMenu = { ...@@ -156,8 +152,10 @@ const RouteMenu = {
}) })
} }
if (!this.openOnceKey) { if (!this.openOnceKey) {
this.sOpenKeys.forEach(item => openKeys.push(item)) this.sOpenKeys.forEach(item => {
} openKeys.push(item)
})
}
this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.sOpenKeys = openKeys) this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.sOpenKeys = openKeys)
} }
...@@ -174,7 +172,7 @@ const RouteMenu = { ...@@ -174,7 +172,7 @@ const RouteMenu = {
}) })
this.$watch('collapsed', val => { this.$watch('collapsed', val => {
if (val) { if (val) {
this.cachedOpenKeys = this.openKeys.concat() this.cachedOpenKeys = this.sOpenKeys.concat()
this.sOpenKeys = [] this.sOpenKeys = []
} else { } else {
this.sOpenKeys = this.cachedOpenKeys this.sOpenKeys = this.cachedOpenKeys
......
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