From d6f537473e1af3b0503f7028745b764da303f512 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Tue, 29 Nov 2022 15:25:06 +0100 Subject: [PATCH] Dark mode fix first page loading --- src/App.ts | 6 ++++++ src/App.vue | 4 ++-- src/common/shared_vuejs.ts | 4 ++++ src/components/CMyElem/CMyElem.vue | 7 +++++++ src/components/CPresentazione/CPresentazione.vue | 14 +------------- src/components/MyHeader/MyHeader.ts | 13 ++++++++++--- 6 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/App.ts b/src/App.ts index c2d9a411..688ebf97 100755 --- a/src/App.ts +++ b/src/App.ts @@ -35,6 +35,8 @@ export default { const site = computed(() => globalStore.site) + const darkcookie = ref(false) + watch(() => finishLoading.value, (newval: boolean, oldval: boolean) => { // console.log('watch finished', newval) if (newval) { @@ -44,6 +46,7 @@ export default { }) + const listaRoutingNoLogin = ['/vreg?', '/offline'] function meta() { @@ -75,6 +78,8 @@ export default { } function mounted() { + darkcookie.value = tools.getCookie('darkmode', false, false, false) === '-1' + scroll() } @@ -130,6 +135,7 @@ export default { return { finishLoading, + darkcookie, } }, } diff --git a/src/App.vue b/src/App.vue index e84d70bc..bb56a9f4 100755 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,7 @@