路由跳转
普通路由
配置路由
js
{
path: "/home",
name: "home",
component: () => import("@/views/home/home.vue"),
meta: {
// ......
}
}
路由跳转和传参
js
const router = useRouter();
const jump = () => {
router.push({
path: "/home",
query: {
id: 1,
name: "SnowAdmin"
}
});
};
路由参数获取
js
const route = useRoute();
onMounted(() => {
console.log(route.query);
});