feat: implement "hash navigation" for settings
This commit is contained in:
parent
768b011961
commit
c03f72cecc
1 changed files with 11 additions and 1 deletions
|
@ -40,10 +40,10 @@
|
||||||
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
import Button from '~/components/Button.vue';
|
import Button from '~/components/Button.vue';
|
||||||
|
|
||||||
const { logout } = useAuth()
|
const { logout } = useAuth()
|
||||||
|
|
||||||
const appConfig = useRuntimeConfig()
|
const appConfig = useRuntimeConfig()
|
||||||
|
|
||||||
interface Page {
|
interface Page {
|
||||||
|
@ -99,6 +99,16 @@ function selectCategory(page: Page) {
|
||||||
selectedPage.value = page.displayName;
|
selectedPage.value = page.displayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// redirects to you privacy if you go to settings#privacy
|
||||||
|
onMounted(() => {
|
||||||
|
const hash = window.location.hash.substring(1).toLowerCase();
|
||||||
|
const foundPage = categories.flatMap(category => category.pages).find(page => page.displayName.toLowerCase() === hash);
|
||||||
|
|
||||||
|
if (foundPage) {
|
||||||
|
currentPage.value = foundPage;
|
||||||
|
selectedPage.value = foundPage.displayName;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue