Closed
Description
This bug this about different path with the same component.
index.vue
<template>
<div>
<router-link :to="{ path: '/' }">root</router-link>
<router-link :to="{ path: '/a' }">a</router-link>
<router-link :to="{ path: '/b' }">b</router-link>
</div>
</template>
beforeRouteEnter: (to, from, next) => {
console.log(111)
next(vm => {
console.log(222, vm) // <- this not always be printed
});
}
main.js
import Index from './index.vue'
Vue.use(VueRouter)
var routes = [
{ path: '/', component: Index },
{ path: '/a', component: Index },
{ path: '/b', component: Index },
]
var router = new VueRouter({
routes: routes
})
Then access / and just switch between a and b, "222" never be printed.
I already tested it on a new empty project generated by vue-cli. I'll upload that if you need.