Nuxt.js: Is there a way to pass parameter to asyncData in mixin?

Created on 24 Jul 2017  路  5Comments  路  Source: nuxt/nuxt.js

If I define asyncData in page component, in the asyncData function, I can access the variable defined before component definition in the .vue file. But in the mixin definition, it's not possible to access the variable defined in page component.
Is there a way to pass parameter to asyncData in mixin?

Most helpful comment

Hi. fetch and asyncData are being called at an early stage before VM instance being created. So all we can do is access passed context. You can use nuxt plugins (with exported function) for adding mixins into that context :) (example)

Unfortunately the example has moved. Could you give a new link if you have one?

All 5 comments

Hi. fetch and asyncData are being called at an early stage before VM instance being created. So all we can do is access passed context. You can use nuxt plugins (with exported function) for adding mixins into that context :) (example)

Thanks a lot!

Hi. fetch and asyncData are being called at an early stage before VM instance being created. So all we can do is access passed context. You can use nuxt plugins (with exported function) for adding mixins into that context :) (example)

Unfortunately the example has moved. Could you give a new link if you have one?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@Erreke see https://nuxtjs.org/guide/plugins#combined-inject 鈽猴笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattdharmon picture mattdharmon  路  3Comments

jaredreich picture jaredreich  路  3Comments

vadimsg picture vadimsg  路  3Comments

bimohxh picture bimohxh  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments