element-plus
Version:
A Component Library for Vue3.0
18 lines (16 loc) • 408 B
text/typescript
import MenuItem from './menu-item'
import { RendererNode } from 'vue'
class Menu {
constructor(public domNode: RendererNode) {
this.init()
}
init(): void {
const menuChildren = this.domNode.childNodes
;[].filter
.call(menuChildren, (child: Node) => child.nodeType === 1)
.forEach((child: Node) => {
new MenuItem(child as HTMLElement)
})
}
}
export default Menu