rewrite method with only id parameter
This commit is contained in:
parent
5217718d7b
commit
4753ada7a9
1 changed files with 5 additions and 5 deletions
|
@ -189,14 +189,14 @@ Menu.prototype.closePopup = function (window) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu.prototype.getMenuItemById = function (items, id) {
|
Menu.prototype.getMenuItemById = function (id) {
|
||||||
if (items instanceof Menu) {
|
let items = this;
|
||||||
items = items.items
|
if (items instanceof Menu) items = this.items
|
||||||
}
|
|
||||||
let found = items.find(item => item.id === id) || false
|
let found = items.find(item => item.id === id) || false
|
||||||
for (let i = 0, length = items.length; !found && i < length; i++) {
|
for (let i = 0, length = items.length; !found && i < length; i++) {
|
||||||
if (items[i].submenu) {
|
if (items[i].submenu) {
|
||||||
found = this.getMenuItemById(items[i].submenu, id)
|
found = items[i].submenu.getMenuItemById(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return found
|
return found
|
||||||
|
|
Loading…
Reference in a new issue