Añadir 'components/layout.js'
parent
43169bdaac
commit
f79e664f03
@ -0,0 +1,20 @@
|
||||
export class Layout extends HTMLElement {
|
||||
constructor() {
|
||||
super()
|
||||
this.attachShadow({mode: 'open'})
|
||||
this.load()
|
||||
addEventListener('hashchange', () => {
|
||||
this.load()
|
||||
})
|
||||
}
|
||||
|
||||
load() {
|
||||
const el = document.createElement('m-project')
|
||||
const path = new URL(
|
||||
window.location.hash.slice(1) || '/',
|
||||
window.location
|
||||
).pathname
|
||||
el.setAttribute('path', path)
|
||||
this.shadowRoot.replaceChildren(el)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue