problem description
when defining a dynamic route such as / user/:id
, you define a normal route / user/edit
, but when accessing the latter, you jump to the previous route and don"t know how to match
related codes
const router = new Router({
mode: "history",
base: process.env.BASE_URL,
routes: [
{
path: "/",
component: () => import("./views/index/Index.vue"),
children: [
{
path: "/",
redirect: {
name: "index"
}
},
{
path: "/index",
name: "index",
component: () => import("./views/pages/Home.vue")
},
{
path: "user/:id",
name: "user_post",
component: ()=>import("./views/pages/Article.vue")
}
]
},
{
path: "/user",
component: () => import("./views/users/User.vue"),
children: [
{
path: "",
redirect: {
name: "profile"
}
},
{
path: "profile",
name: "profile",
component: () => import("./components/user/Profile.vue")
},
{
path: "editor",
name: "editor",
component: () => import("./components/user/Editor.vue")
}
]
}
]
})
what I expect is to visit the user"s home page through the user"s id on the home page, and then / user/profile
, / user/editor
and so on are the routes for the user"s home page information, editing articles, etc., but now visiting / user/editor
directly jumps to / user/:id
, that is, the route of user_post. Do not know any good solution?