|
|
|
@ -42,16 +42,17 @@ export class NavMenu extends HTMLElement {
|
|
|
|
this.shadowRoot.append(this.pageList)
|
|
|
|
this.shadowRoot.append(this.pageList)
|
|
|
|
this.renderPageList()
|
|
|
|
this.renderPageList()
|
|
|
|
this.shadowRoot.addEventListener('click', e => {
|
|
|
|
this.shadowRoot.addEventListener('click', e => {
|
|
|
|
if (this.handleLinks) {
|
|
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e.target.classList.contains('page')) {
|
|
|
|
if (e.target.classList.contains('page')) {
|
|
|
|
|
|
|
|
if (this.handleLinks) {
|
|
|
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
|
|
|
}
|
|
|
|
this.dispatchEvent(new CustomEvent(
|
|
|
|
this.dispatchEvent(new CustomEvent(
|
|
|
|
'close-menu', {bubbles: true}
|
|
|
|
'close-menu', {bubbles: true}
|
|
|
|
))
|
|
|
|
))
|
|
|
|
}
|
|
|
|
if (this.handleLinks) {
|
|
|
|
if (this.handleLinks) {
|
|
|
|
const hash = '#' + e.target.innerText
|
|
|
|
location.hash = `#${e.target.innerText}`
|
|
|
|
location.hash = hash
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|