diff --git a/examples/routers/menu.vue b/examples/routers/menu.vue index 686c7d9..c215ce6 100644 --- a/examples/routers/menu.vue +++ b/examples/routers/menu.vue @@ -44,13 +44,14 @@ Option 12 - + @@ -108,6 +109,7 @@ import custemMenuItem from './custem-menu-item.vue' data () { return { openNames: ['1'], + openNames2: [], menuList: [ { name: '111', @@ -184,8 +186,10 @@ import custemMenuItem from './custem-menu-item.vue' }, setOpenNames () { this.openNames = ['2', '3']; + this.openNames2 = ['222', '222-222', '222-222-222', '222-222-222-111'] this.$nextTick(() => { this.$refs.menu.updateOpened(); + this.$refs.menu2.updateOpened(); }) }, addNewItem () { diff --git a/src/components/menu/menu.vue b/src/components/menu/menu.vue index 89b287d..8553a81 100644 --- a/src/components/menu/menu.vue +++ b/src/components/menu/menu.vue @@ -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) { diff --git a/src/components/select/select.vue b/src/components/select/select.vue index ea1f5d1..9e6827f 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -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){ -- libgit2 0.21.4