created() {
let uri = window.location.search.substring(1);
let params = new URLSearchParams(uri);
console.log(params.get("var_name"));
},
//Without vue-router
const User = {
template: '<div>User {{ $route.params.id }}</div>'
}
console.log('The id is: ' + this.$route.params.id);
<script setup>
import { useRoute } from 'vue-router';
const route = useRoute();
const id = route.params.id; // read parameter id (it is reactive)
</script>
<router-link :to="{ name: 'movie', params: { id: item.id } }">{{ item.title }}</router-link>