'How to acess url GET parameter in setup() Vue 3?
This is my URL: http://localhost:8888/static/?foo=true via which Vue 3 application works.
In setup() I want to get foo parameter.
This is my code:
import { useRoute } from 'vue-router';
import { defineComponent, reactive, ref, Ref, watch, createApp, onMounted} from 'vue';
export default defineComponent({
name: 'App',
setup() {
onMounted(() => {
const route = useRoute();
console.log(route);
console.log(route.params.foo);
console.log(route.query.foo);
});
},
})
Could anyone say how to do it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

