Example: http://run.plnkr.co/O8drrKqdru329Cf4/#/a
Source: http://plnkr.co/edit/fjHGwqUnUTzq2eDpKVTa?p=preview
Standalone source in case plunker is down: http://pastebin.com/bN2vMGY4
Steps in the above example:
Result:
#/bIn the previous version of vue-router, using abort() would revert the hash back to the correct path.
On a site note, how do we handle the removal of abort()? redirect() needs you to know the previous path, where as abort() automatically reverted back to the previous path.
Hi, thanks for filling this issue.
Abort is no longer needed since you can just do nothing inside guard hooks to abort the navigation.
http://plnkr.co/edit/NuiJlxJV4IkhnXOwfgqr
Please read more about navigation guards here:
http://router.vuejs.org/en/advanced/navigation-guards.html
If neither redirect nor next is called, the navigation will be cancelled.
If neither redirect nor next is called, the navigation will be cancelled.
While navigation is cancelled (i.e. the correct component is displayed in the router outlet), the hash change is not canceled. Previously abort() restored the correct hash / path.
If hash is changed outside of using <router-link />, i.e. browser forward / back or using <a href="#/b" />
#/b for example)beforeEach firesredirect or next not called#/bIf hash is changed outside of using
, i.e. browser forward / back or using <a href="#/b" />
- browser hash changes (to #/b for example)
- beforeEach fires
- redirect or next not called
- navigation is canceled
- hash remains #/b
I see.. It may indeed be a bug. @yyx990803
Most helpful comment
See https://github.com/vuejs/vue-router/releases/tag/v2.0.0-rc.6