You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote two components, a login.vue and a main.vue, after click a button in login.vue ,it executes 'route.go('/main')', the router-view renderered the main.vue content, but, in the main.vue's ready method, 'router.app.$route.path' returns '/login', not '/main', I don't know other ways to get the right route path in 'ready' method after a router-view is changed
I use vue-router 0.4.0, and vue.js 0.12.10
is there a proper way to get the right path after change a route?
before I got the problem above, I use 'route.afterEach' method to capture the route change event, it's seems that this method is removed in vue-router 0.4.0
I find a way, use 'router._currentRoute.path' can read the right path in 'ready' method, but, I think it's not a good way
The text was updated successfully, but these errors were encountered:
sorry, I don't read the new example completely, I saw the new 'route' attribute in vue component
but, look, I put a router-view label in main.vue, after I changed the menu item in main.vue, the main.vue's router-view's content changed, then main.vue's life-cycle methods are invoked again
I solve the problem, the code like below:
module.exports = {
route: {
function(transition){
this.path = transition.to.path
}
},
data: {
path: '',
menus: ['a', 'b', 'c']
},
ready: function(){// this method will be invoked every time after the router-view is re-renderered
dosth(this.path)
}
}
Simplify my scene:
I wrote two components, a login.vue and a main.vue, after click a button in login.vue ,it executes 'route.go('/main')', the router-view renderered the main.vue content, but, in the main.vue's ready method, 'router.app.$route.path' returns '/login', not '/main', I don't know other ways to get the right route path in 'ready' method after a router-view is changed
I use vue-router 0.4.0, and vue.js 0.12.10
is there a proper way to get the right path after change a route?
before I got the problem above, I use 'route.afterEach' method to capture the route change event, it's seems that this method is removed in vue-router 0.4.0
I find a way, use 'router._currentRoute.path' can read the right path in 'ready' method, but, I think it's not a good way
The text was updated successfully, but these errors were encountered: