small update before zzz
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export const RouterLink = (link: string, name: string) => {
|
export const RouterLink = (link: string, name: string) => {
|
||||||
return `
|
return `
|
||||||
<a href="#" d-click="event.preventDefault(); loadPage('${link}')">${name}</a>
|
<a href="${link}" d-click="event.preventDefault(); loadPage('${link}')">${name}</a>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,7 @@ async function loadPage(route?: string) {
|
|||||||
const file = await import(/* @vite-ignore */ './pages' + fileName)
|
const file = await import(/* @vite-ignore */ './pages' + fileName)
|
||||||
templatedVirtualDom = await eval(compileToString(eval(file.default)()))
|
templatedVirtualDom = await eval(compileToString(eval(file.default)()))
|
||||||
}
|
}
|
||||||
|
console.log
|
||||||
documentBody.innerHTML = templatedVirtualDom
|
documentBody.innerHTML = templatedVirtualDom
|
||||||
// here we hydrate/re-hydrate the page content
|
// here we hydrate/re-hydrate the page content
|
||||||
await hydratePage()
|
await hydratePage()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export default () => {
|
|||||||
<div class="p-6 border-neutral-800 rounded-lg container__content border">
|
<div class="p-6 border-neutral-800 rounded-lg container__content border">
|
||||||
${Counter()}
|
${Counter()}
|
||||||
<div class="flex gap-1 justify-center">
|
<div class="flex gap-1 justify-center">
|
||||||
reutrn ${RouterLink('/', 'Home')}
|
go ${RouterLink('/subroute/deep/deeper/deepest', 'deeper')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
scrollbar-color: #27272a #27272a;
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container__content {
|
.container__content {
|
||||||
|
|||||||
Reference in New Issue
Block a user