The paths in route and watch are different after Vue refresh?

< H1 > there was a problem using vue-router as a navigation bar < / H1 > < H2 > the navigation bar looks something like this < / H2 >

clipboard.png

/user/user-profile

clipboard.png

rootePath /topic/topic-new

clipboard.png

< H2 > We are sure that we did assign a value to rootePath in the first step, but the monitoring method has changed, and the this.$route.path is still / user/user-profile at this time. < / H2 > < H2 > I don"t know what happened. Is there anything wrong with us? Is there anything special that vuejs/vue-router needs to pay attention to? < / H2 > "("-"- _ -;)" < / H2 > "

something strange happened, when we set up a valid routing path for routePath , everything returned to normal! Who"s going to tell us what"s going on here? huh? "(_;)"


listen for router changes directly with

watch: {
$router()
}
Menu