路由文件router文件夹下的index.js文件中
原始文件:
const routes = [
{
path: “/”,
name: “Home”,
component: Home
},
{
path: “/about”,
name: “About”,
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: “about” / “…/views/About.vue”)
}
];
路由重定向:redirect
const routes = [
{
path: “/”,
redirect: “login”
},
{
path: “/”,
name: “login”,
component: import("…/views/Login/index.vue")
},
{
path: “/about”,
name: “About”,
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/ webpackChunkName: “about” */ “…/views/About.vue”)
}
];
vue路由重定向
最新推荐文章于 2025-02-22 19:06:02 发布