summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelianthella <git@gumi.ca>2020-12-25 21:00:29 -0500
committerHelianthella <git@gumi.ca>2020-12-25 21:05:54 -0500
commit965059649ff6de8849f5091435befddba18ced93 (patch)
treeed8d61f1451fb943fe82e91e3c517d97231f1e92
parentaa43f570ae5fe19f3405bff9c800bcaa442c0f33 (diff)
downloadwebsite-965059649ff6de8849f5091435befddba18ced93.tar.gz
website-965059649ff6de8849f5091435befddba18ced93.tar.bz2
website-965059649ff6de8849f5091435befddba18ced93.tar.xz
website-965059649ff6de8849f5091435befddba18ced93.zip
display a skeleton layout while dynamic views are loading
-rw-r--r--src/App.vue16
-rw-r--r--src/router/index.ts5
2 files changed, 19 insertions, 2 deletions
diff --git a/src/App.vue b/src/App.vue
index 435f7b2..f46f063 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,11 @@
<template>
<Logo class="header"/>
<Navigation class="nav"/>
- <router-view class="content"/>
+ <router-view v-if="loaded" class="content"/>
+ <main v-else class="content" role="alert" aria-busy="true">
+ <h1>&nbsp;</h1>
+ <p>Loading...</p>
+ </main>
<Copyright class="footer"/>
</template>
@@ -84,5 +88,13 @@ import Copyright from "@/components/Footer.vue";
Copyright,
},
})
-export default class AppV extends Vue {}
+export default class AppV extends Vue {
+ loaded = false;
+
+ mounted () {
+ self.addEventListener("initial-load", () => {
+ this.loaded = true;
+ });
+ }
+}
</script>
diff --git a/src/router/index.ts b/src/router/index.ts
index 8165667..04828e4 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -49,6 +49,11 @@ const router = createRouter({
routes,
});
+router.beforeResolve((to, from, next) => {
+ self.dispatchEvent(new Event("initial-load"));
+ next();
+});
+
router.afterEach((to,) => {
const mainTitle = document.querySelector("#app > .content > h1");