element-plus/packages/utils/menu/menu-bar.ts

19 lines
414 B
TypeScript
Raw Normal View History

2020-07-28 17:48:40 +08:00
import MenuItem from './menu-item'
import type { RendererNode } from 'vue'
2020-07-28 17:48:40 +08:00
class Menu {
2020-11-12 14:43:55 +08:00
constructor(public domNode: RendererNode) {
2020-07-28 17:48:40 +08:00
this.init()
}
init(): void {
2020-11-12 14:43:55 +08:00
const menuChildren = this.domNode.childNodes
;[].filter
.call(menuChildren, (child: Node) => child.nodeType === 1)
.forEach((child: Node) => {
new MenuItem(child as HTMLElement)
})
2020-07-28 17:48:40 +08:00
}
}
export default Menu