()
| 2 | import { useRoute } from "vue-router"; |
| 3 | |
| 4 | export function useRouterParams() { |
| 5 | const route = useRoute(); |
| 6 | if (!route) { |
| 7 | throw new Error( |
| 8 | "Failed to get Vue-Router! Please check if the Hook call source is in the Vue component." |
| 9 | ); |
| 10 | } |
| 11 | const currentRoutePath = computed(() => route.path); |
| 12 | return { |
| 13 | currentRoutePath |
| 14 | }; |
| 15 | } |