this.app won't work inside beforeEnter
See original GitHub issueInside a beforeEnter
per-route guard the Router instance is this.a
instead of this
.
Example:
new VueRouter({
routes: [
{
beforeEnter: (to, from, next) => {
this.app // app is undefined
this.a.app // this works!
}
}
]
})
It’s normal?
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Vue-router: beforeEnter guard doesn't work properly for ...
The best solution I found was to use beforeEach guard instead of beforeEnter. beforeEnter is a per route guard, and then it was...
Read more >[vue-router] beforeEnter access vue app's methods - Get Help
I want to call the method of vue app from router. I do this like: var router = New VueRouter({ routes: [{ path:...
Read more >How to implement route guard in vue.js | by Vipin Cheriyanveetil
These guards are hooked to our function named “guardMyroute”. The guard's name is “beforeEnter”. So what happens is any time this route is...
Read more >Routes | Framework7 Documentation
Routes defined on app init are default routes, they will be available for any View/Router in the app. If you have a multi-view/router...
Read more >Using Vue 3's Router in Practice - Daily.dev
So I have modified the App.vue file and routes file to configure a new ... to add another <router-view> inside the Message view...
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 Free
Top 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
same problem
You’re using arrow functions that doesn’t have access to the desired
this
, please use normal functions instead: