Questions tagged [beforerouteenter]

6 questions
2
votes
1 answer

Vue testing beforeRouteEnter navigationGuard with JEST / Vue-test-utils

i have a component which uses beforeRouteEnter(to, from, next) { return next((vm) => { vm.cacheName = from.name }) }, it takes previous route name and saves it into current component variable calld - cacheName how can i test that with JEST? i…
mateocodeo
  • 251
  • 2
  • 6
2
votes
0 answers

vue beforeRouteEnter not being called

In one of my components the hook beforeRouteEnter is not being called. The route to this component looks like... { path: '/blunders/:gameID', name: 'Blunders', component: () => import('../views/Blunders.vue'), }, My beforeRouteEnter…
honkskillet
  • 3,007
  • 6
  • 31
  • 47
1
vote
2 answers

why is the code in beforeRouteEnter's next callback function called before mounted hook

in my memory, mounted hook is called at first, and then next callback function in beforeRouteEnter execute. The vue router document also say that, this is the url: Navigation Guards. but when I test, the result is not right. This is the codesanbox…
mofiter
  • 11
  • 2
1
vote
1 answer

Vue beforeRouteEnter wait for child component to finish request

I have a Vue app where I am using beforeRouteEnter to load data, and avoid a "flash of unloaded content". On some pages, this is easy: async beforeRouteEnter(to, from, next) { const newestPosts = await getNewestPosts(); next(vm => vm.posts…
yathern
  • 319
  • 1
  • 3
  • 14
1
vote
1 answer

Using vue router BeforeRouteEnter method to wait for http request to complete

Hi I'm trying to make it so that when a user opens a page it won't open until the data from the server is successfully retrieved so that it won't appear after 0.5s or so after the user enters. To do this I read that I need to use BeforeRouteEnter…
User2019
  • 37
  • 1
  • 5
0
votes
1 answer

Vue router beforeRouteEnter - after refreshing the page, the button name disappears