fix: menu trigger inlineCollapsed not have animation #200

pull/225/head
tangjinzhou 2018-09-21 21:46:42 +08:00
parent b604fd5c0a
commit a9f31fc477
1 changed files with 6 additions and 4 deletions

View File

@ -50,7 +50,7 @@ const Menu = {
prop: 'selectedKeys', prop: 'selectedKeys',
event: 'selectChange', event: 'selectChange',
}, },
mounted () { created () {
this.preProps = { ...this.$props } this.preProps = { ...this.$props }
}, },
watch: { watch: {
@ -63,6 +63,7 @@ const Menu = {
} }
if (hasProp(this, 'openKeys')) { if (hasProp(this, 'openKeys')) {
this.setState({ sOpenKeys: nextProps.openKeys }) this.setState({ sOpenKeys: nextProps.openKeys })
this.preProps = { ...nextProps }
return return
} }
if (nextProps.inlineCollapsed && !preProps.inlineCollapsed) { if (nextProps.inlineCollapsed && !preProps.inlineCollapsed) {
@ -108,10 +109,11 @@ const Menu = {
this.leaveAnimationExecutedWhenInlineCollapsed = false this.leaveAnimationExecutedWhenInlineCollapsed = false
this.inlineOpenKeys = [] this.inlineOpenKeys = []
let sOpenKeys let sOpenKeys
if (hasProp(this, 'defaultOpenKeys')) {
sOpenKeys = props.defaultOpenKeys if (hasProp(this, 'openKeys')) {
} else if (hasProp(this, 'openKeys')) {
sOpenKeys = props.openKeys sOpenKeys = props.openKeys
} else if (hasProp(this, 'defaultOpenKeys')) {
sOpenKeys = props.defaultOpenKeys
} }
return { return {
sOpenKeys, sOpenKeys,