-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird behavior vue-router 2.0.1 #853
Comments
I have the same problem now.I have found that adding query |
Hi, thanks for filling this issue. Please follow the Issue Reporting Guidelines and provide a live reproduction on jsfiddle, codepen etc. Thanks! |
It seems that te problem happens only when i using I started the app with vue 1.0 using another router, so i'm just beginning to change the As @Yiiu said using I'll try to create a jsfiddle asap to reproduce the problem. |
I am able to produce the steps, please see below. Vue.js version2.1.0 Vue-Router version2.0.3 - using hash mode Reproduction Linkhttps://jsfiddle.net/starkhorn/pz56e342/4/ Steps to reproduce / What is happeningThe issue happens when the current browser hash is different from the one being redirected to (using a navigation guard). After the redirect, vue-router will not work when the browser hash changes. I tried stepping through the code, it seems that, for some reason, the callback function that should add an event listener to window's hashchange event is skipped -- the transitionTo() gets called though. history.transitionTo(getHash(), function () {
window.addEventListener('hashchange', function () {
history.onHashChange()
})
}) In the JSFiddle provided, if you change the initial hash to '#/login', vue-router will correctly listen to window's hashchange event. Note: navigation using router-link still works though. |
Seems to be a bug. |
I'm not sure if this is a bug or if i'm doing something wrong.
I looked out on the open issues and didn't see anything like this.
I'm trying to secure my web app using jwt, and i'm having trouble after my app redirect to login when i try to access a path that requires auth and the token is not valid.
The router does the redirection to login and after the authentication the redirection to the secured page also works fine, but then the router dies, no other route works, no errors or anything on the console either, the weird thing is that after a browser refresh everything works normal again.
It only happens after a redirect like this one: { path: '/', redirect: '/app' }, but /app requires authorization, so next('/login'); is executed (check my code below), then if the login is successful i execute self.$router.push('/app'); and that's that, i have to refresh in order to continue.
In firefox over windows64 it happens when i enter the app the first time if there is no token (when it has to do the redirection to login), if i delete the token and close/open the browser it happens again.
In chrome over windows64 happens sometimes, also after a redirect, if go directly to the login page it works normally.
Im using this:
my routes look like:
loader is a function that concatenates the full path of te component an returns a function to use resolve
and in my app.js i have this:
Thanks.
The text was updated successfully, but these errors were encountered: