clarkdo / hare

🐇 Application boilerplate based on Vue.js 2.x, Koa 2.x, Element-UI and Nuxt.js

Home Page:https://nuxt-hare.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

don't execute asyncData in the vue router beforeEach。

gotoin opened this issue · comments

What problem does this feature solve?

cache !
i need realize forward refresh and backward do not refresh

now the asyncData is called every time before loading the component。

i need a configuration that sets the asyncData life cycle

thanks

This feature request is available on Nuxt community (#c54)

Oh. Good call.
I've had similar issues to you and couldn't figure out what caused it.

I wonder what would be a better way.

PR?

@gotoin @renoirb
If I understood correctly, you can combine the asyncData with store, only load data in asyncData when store is null, so that asyncData won't be called in backward.

@clarkdo
Yes, but i need implement a common solution, don't need to set each page,
as
page A -> B -> A -> go back(-1)

  1. A -> B , push A vnode cache, get B data from asyncData
  2. B -> A, push B vnode cache, get A data from asyncData
  3. go back(-1), pop B vnode from cache, then get A vnode

nuxt/nuxt#3541