fixed bug of menu when use recursive components and set accordion

This commit is contained in:
zhigang.li 2018-06-04 11:45:55 +08:00
parent e549c92b1d
commit 1f7905d450
3 changed files with 14 additions and 4 deletions

View file

@ -79,6 +79,9 @@
updateOpenKeys (name) {
let names = [...this.openedNames];
const index = names.indexOf(name);
if (this.accordion) findComponentsDownward(this, 'Submenu').forEach(item => {
item.opened = false;
});
if (index >= 0) {
let currentSubmenu = null;
findComponentsDownward(this, 'Submenu').forEach(item => {
@ -87,11 +90,14 @@
item.opened = false;
}
});
findComponentsUpward(currentSubmenu, 'Submenu').forEach(item => {
item.opened = true;
});
findComponentsDownward(currentSubmenu, 'Submenu').forEach(item => {
item.opened = false;
});
} else {
if (this.mode === 'horizontal' && this.accordion) {
if (this.accordion) {
let currentSubmenu = null;
findComponentsDownward(this, 'Submenu').forEach(item => {
if (item.name === name) {

View file

@ -427,7 +427,7 @@
let initialValue = Array.isArray(value) ? value : [value];
if (!multiple && (typeof initialValue[0] === 'undefined' || (String(initialValue[0]).trim() === '' && !Number.isFinite(initialValue[0])))) initialValue = [];
return initialValue.filter((item) => {
return Boolean(item) || item === 0
return Boolean(item) || item === 0;
});
},
processOption(option, values, isFocused){