feat: update the page title using a watcher

Added a watcher (watchEffect) to App.vue to update the page title
always when a dependency changes. The afterEach hook was removed from
the router.
This commit is contained in:
2026-07-28 19:55:12 +02:00
parent f4d8952c54
commit b245aa4a39
2 changed files with 12 additions and 7 deletions
+7 -1
View File
@@ -18,8 +18,12 @@ limitations under the License.
import Navbar from './features/nav/components/Navbar.vue';
import Footer from './features/footer/components/Footer.vue';
import { updatePageTitle } from './router';
import { useColorScheme } from './features/colorScheme/composables/useColorScheme';
import { ref, provide, watch } from 'vue';
import { ref, provide, watch, watchEffect } from 'vue';
import { useRoute } from 'vue-router';
const route = useRoute();
const { getColorScheme, updateColorScheme } = useColorScheme();
const colorScheme = ref(getColorScheme());
@@ -42,6 +46,8 @@ watch(colorScheme, (newValue) => {
document.body.classList.remove('color-scheme-auto');
}
});
watchEffect(() => updatePageTitle(route));
</script>
<template>