2
votes

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

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

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

The Loading property looks like this:

enter image description here

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 components... 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

2

2 Answers

5
votes

You can use window.$nuxt for this.

0
votes

I used this._vm.

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