vue3中使用路由
import { useRouter, useRoute, ref } from 'vue-router'; const router = useRouter(); const route = useRoute() // 获取所有的路由 const routes = router.getRoutes(); // 获取当前路由 let currentRoute = computed(() => router.currentRoute.value.path); let storeId = ref('') // 路由跳转 const goTo = (path: string) => { router.push({ path: path }) } onMounted(() => { storeId.value = route.query.storeId || '' })