About the click-to-jump problem of router-link in vue?

the route looks like this on the first click http://localhost:8080/apple/red/detail/3

when I click multiple times on the redirected page, routes accumulate at the end, http://localhost:8080/apple/red/detail/3

Why is this?

< router-link: to= "{path:"apple/red/detail/3"}" > to apple < / router-link >
mode:"history",
routes: [

{
  path: "/",
  name: "HelloWorld",
  component: HelloWorld
},
{
    path:"/apple/:color/detail/:type",
    
    name:"apple",
    component:Apple
}

]

Apr.05,2021

path:'/apple/:color?/detail/:type?' Try this.


is in router-link, changed to {path:'/apple/red/detail/3'}

.
Menu