在Vue2.7中使用useRouter 和useRoute
在路由文件中添加下面两个函数替代,等官方相应API完成
export function useRouter() {
return router;
}
export function useRoute() {
return router.currentRoute;
}
const router = new Router({
mode: "hash",
routes: [
{
path: "/",
// component: () => import("@/pages/home/Home.vue"),
component: Home
},
],
});