feat: query param based navigation
This commit is contained in:
@@ -36,6 +36,7 @@ const { selectedButton: selected, selectorPosition } = useButtonNavigation({
|
|||||||
if (isSubmenu(buttonName)) {
|
if (isSubmenu(buttonName)) {
|
||||||
router.push({
|
router.push({
|
||||||
query: {
|
query: {
|
||||||
|
screen: "settings",
|
||||||
menu: buttonName,
|
menu: buttonName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -153,11 +154,12 @@ watch(
|
|||||||
if (isSubmenu(newSelected)) {
|
if (isSubmenu(newSelected)) {
|
||||||
router.push({
|
router.push({
|
||||||
query: {
|
query: {
|
||||||
|
screen: "settings",
|
||||||
menu: newSelected.split(/[A-Z]/)[0],
|
menu: newSelected.split(/[A-Z]/)[0],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
router.push({ query: { menu: undefined } });
|
router.push({ query: { screen: "settings", menu: undefined } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
definePageMeta({
|
|
||||||
layout: false,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<NuxtLayout name="default">
|
|
||||||
<template #top>
|
|
||||||
<SettingsTopScreen />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #bottom>
|
|
||||||
<SettingsBottomScreen />
|
|
||||||
</template>
|
|
||||||
</NuxtLayout>
|
|
||||||
</template>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
definePageMeta({
|
|
||||||
layout: false,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<NuxtLayout name="default">
|
|
||||||
<template #top>
|
|
||||||
<ContactTopScreen />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #bottom>
|
|
||||||
<ContactBottomScreen />
|
|
||||||
</template>
|
|
||||||
</NuxtLayout>
|
|
||||||
</template>
|
|
||||||
@@ -2,16 +2,25 @@
|
|||||||
definePageMeta({
|
definePageMeta({
|
||||||
layout: false,
|
layout: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const screen = computed(() => route.query.screen as string | undefined);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NuxtLayout name="default">
|
<NuxtLayout name="default">
|
||||||
<template #top>
|
<template #top>
|
||||||
<HomeTopScreen />
|
<HomeTopScreen v-if="!screen" />
|
||||||
|
<ContactTopScreen v-else-if="screen === 'contact'" />
|
||||||
|
<ProjectsTopScreen v-else-if="screen === 'projects'" />
|
||||||
|
<SettingsTopScreen v-else-if="screen === 'settings'" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #bottom>
|
<template #bottom>
|
||||||
<HomeBottomScreen />
|
<HomeBottomScreen v-if="!screen" />
|
||||||
|
<ContactBottomScreen v-else-if="screen === 'contact'" />
|
||||||
|
<ProjectsBottomScreen v-else-if="screen === 'projects'" />
|
||||||
|
<SettingsBottomScreen v-else-if="screen === 'settings'" />
|
||||||
</template>
|
</template>
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
definePageMeta({
|
|
||||||
layout: false,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<NuxtLayout name="default">
|
|
||||||
<template #top>
|
|
||||||
<ProjectsTopScreen />
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #bottom>
|
|
||||||
<ProjectsBottomScreen />
|
|
||||||
</template>
|
|
||||||
</NuxtLayout>
|
|
||||||
</template>
|
|
||||||
@@ -96,7 +96,8 @@ export const useContactStore = defineStore("contact", {
|
|||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.isOutro = false;
|
this.isOutro = false;
|
||||||
navigateTo("/");
|
const router = useRouter();
|
||||||
|
router.push({ query: {} });
|
||||||
}, 2000);
|
}, 2000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,7 +61,8 @@ export const useHomeStore = defineStore("home", {
|
|||||||
const timeline = gsap.timeline({
|
const timeline = gsap.timeline({
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
this.isOutro = true;
|
this.isOutro = true;
|
||||||
navigateTo(`/${to}`);
|
const router = useRouter();
|
||||||
|
router.push({ query: { screen: to } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user