mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-21 21:44:40 +03:00
1 parent
8ad6157f7e
commit
ae0ef63a03
1 file changed
+10
-3
+10
-3
@@ -42,18 +42,25 @@ const router = createRouter({
|
|||||||
});
|
});
|
||||||
|
|
||||||
let loader: ActiveLoader | null = null;
|
let loader: ActiveLoader | null = null;
|
||||||
|
let loaderTimeoutId: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
router.beforeEach((to, from) => {
|
router.beforeEach((to, from) => {
|
||||||
// Only show loading for actual route changes, not just query param changes
|
// Only show loading for actual route changes, not just query param changes
|
||||||
if (to.path !== from.path) {
|
if (to.path !== from.path) {
|
||||||
const theme = useAppTheme();
|
const theme = useAppTheme();
|
||||||
loader = $loading?.show({
|
loaderTimeoutId = setTimeout(() => {
|
||||||
color: theme.value.primary.color,
|
loader = $loading?.show({
|
||||||
});
|
color: theme.value.primary.color,
|
||||||
|
});
|
||||||
|
}, 350);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
|
if (loaderTimeoutId) {
|
||||||
|
clearTimeout(loaderTimeoutId);
|
||||||
|
loaderTimeoutId = null;
|
||||||
|
}
|
||||||
if (loader) {
|
if (loader) {
|
||||||
loader.hide();
|
loader.hide();
|
||||||
loader = null;
|
loader = null;
|
||||||
|
|||||||
Reference in new issue
Block a user