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