I don't need routing for my Vue app so I didn't add the Vue router package to my project.
Given the following sample code for the App.vue
<script setup lang="ts">
import { onMounted } from "vue";
onMounted(() => {
const routeHashContent = window.location.hash.substring(1);
const hashParameters = new URLSearchParams(routeHashContent);
const hashParameter = hashParameters.get("foo");
if (hashParameter === null) {
console.log("not found.");
return;
}
console.log(hashParameter);
});
</script>
<template />
I could call the app with the url
http://localhost:5173/#?foo=bar
to make it work. Is there a way to get rid of the hash? The url might look like so
http://localhost:5173?foo=bar
Which code should I use instead of const routeHashContent = window.location.hash.substring(1); to get the queries?