How can I access $route.params property inside setup method in Vue.js? When I try to access it inside other method, or inside template everything works fine, but i cannot access it inside setup method.
You should use composable function useRoute
to get the current route:
import { useRoute } from "vue-router";
export default {
setup() {
const route =useRoute()
//then use route.params
},
};