javascript - VueNuxt: How can I access Nuxt instance in vuex store? - Stack Overflow

admin2025-04-19  0

I would like to write a getter to return this.$nuxt.$loading from a vuex store file. (/)

This question is linked to my other question: Nuxt/Vue: How to position custom loading ponent

And now I thought of listening to this loading property to display my Loading ponent within the page.

The Loading property looks like this:

So I would like to return this.$nuxt.$loading.data.$route.show from the vuex store. If it is true, I want to show my custom loader and if its false not – of course.

To do that I would like to access this.$nuxt but this is undefined in my vuex store. It is only present in my ponents... I tried $nuxt – same result.

I don't know if this is right or at least one way to achieve what I want, and I am definitely open for suggestions.

Thanks in advance. Cheers

I would like to write a getter to return this.$nuxt.$loading from a vuex store file. (https://nuxtjs/api/configuration-loading/)

This question is linked to my other question: Nuxt/Vue: How to position custom loading ponent

And now I thought of listening to this loading property to display my Loading ponent within the page.

The Loading property looks like this:

So I would like to return this.$nuxt.$loading.data.$route.show from the vuex store. If it is true, I want to show my custom loader and if its false not – of course.

To do that I would like to access this.$nuxt but this is undefined in my vuex store. It is only present in my ponents... I tried $nuxt – same result.

I don't know if this is right or at least one way to achieve what I want, and I am definitely open for suggestions.

Thanks in advance. Cheers

Share Improve this question asked Jul 11, 2018 at 12:44 MercMerc 4,5908 gold badges58 silver badges87 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You can use window.$nuxt for this.

I used this._vm.

You can see it in there if you do console.log(this) in Vuex.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745066581a283023.html

最新回复(0)