In-component Navigation Guards
See original GitHub issue- I confirm that this is an issue rather than a question.
Bug report
Steps to reproduce
Create a global component with beforeRouteEnter
, beforeRouteUpdate
and beforeRouteLeave
navigation guards.
https://codesandbox.io/embed/codesandbox-vuepress-navigation-guards-9iobr
What is expected?
The in-component navigation guards output to console.
What is actually happening?
The in-component navigation guards do not output.
Other relevant information
- Output of
npx vuepress info
in my VuePress project:
Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.16.0 - ~/.yarn/bin/yarn
npm: 6.10.2 - ~/.nvm/versions/node/v10.16.0/bin/npm
Browsers:
Chrome: 76.0.3809.100
Firefox: 64.0
Safari: 12.1.2
npmPackages:
@vuepress/core: 1.0.2
@vuepress/theme-default: 1.0.2
vuepress: 1.0.2 => 1.0.2
npmGlobalPackages:
vuepress: Not Found
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Navigation Guards | Vue Router
As the name suggests, the navigation guards provided by Vue router are primarily used to guard navigations either by redirecting it or canceling...
Read more >In Component Navigation Guards - A Vue.js Lesson From our ...
A navigation guard acts as a middleware that can protect a route component. We're also learning how to access data from child components...
Read more >Protecting Vue Routes with Navigation Guards - CSS-Tricks
Navigation guards are a specific feature within Vue Router that provide additional functionality pertaining to how routes get resolved. They are ...
Read more >How to implement route guard in vue.js | by Vipin Cheriyanveetil
I was recently developing an application vue.js and I came to this situation to implement route authentication or guard. Vue Router has few...
Read more >Vue Router Router and Component Guards and Navigation ...
In this article, we'll look at defining route and in-component guards and look at the full navigation resolution flow.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure. And sorry, wasn’t implying you’re a newcomer by the way! I’ve seen your themes.
Perhaps I should have said “you can also” rather than “you shouldn’t need to”.
Anyway, the reason I suggested
$page
is because you get access to bothregularPath
(the path of the physical page folder) andpath
; normally this is the same as$route.path
, but is different if you’ve set a frontmatterpermalink
.The reason I found this page is because I’m also building breadcrumbs (and I used
$page.regularPath
to do it):Thanks for your explanation also.
😄
https://vuepress-theme-hope.github.io/guide/layout/breadcrumb/
This is what I build now.
Related files are under https://github.com/vuepress-theme-hope/vuepress-theme-hope/blob/v1/packages/components/src/client/BreadCrumb.ts
Finally use computers.
I was trying to build the whole structure through $site.pages, and even tring to cache the keys to fast update structure in an HMR.
Sadly that vuepress broke hmr in its updates.