Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Nuxt.js #10

Closed
MrRossBennett opened this issue Feb 12, 2018 · 7 comments
Closed

Integration with Nuxt.js #10

MrRossBennett opened this issue Feb 12, 2018 · 7 comments
Assignees

Comments

@MrRossBennett
Copy link

Hello - currently working on getting this excellent module to work with Nuxt.js. I'm using Nuxt in SSR mode. When I follow your example here, I get:

module namespace not found in mapState():

and...

this.$store.getters[getterType] is not a function

Pretty sure it's to do with when Nuxt inits the Vuex store.

Any ideas?

Thanks!

@maoberlehner
Copy link
Owner

Hey @MrRossBennett I'll look into this today!

@maoberlehner maoberlehner self-assigned this Feb 13, 2018
@maoberlehner
Copy link
Owner

Hey @MrRossBennett,

I couldn't reproduce your exact problem but I found out, that dynamically registering store modules with registerModule() might not work as expected with Nuxt, so what I did was that I load the store module as usual directly when initializing the store.

Please let me know if not dynamically registering the store module helps with your problem.

@maoberlehner
Copy link
Owner

I'm closing this because of inactivity and because I can't reproduce the exact problem. Please open a new issue with more informations (live code example in the best case) if the problem still exists. Thx.

@vodnicearv
Copy link

vodnicearv commented Mar 29, 2019

I also ran into this problem.
If use store/index.js file as a store - everything is ok.
But if you use store/user.js, when we call the function mapFields:

export default {
    computed: {
      ...mapFields([
        'user.phone',
        'user.password'
      ])
    }
}

we get the error: this.$store.getters[getterType] is not a function

PS. Maybe the problem is that Nuxt creates store dynamically

@vodnicearv
Copy link

The problem is solved if you add getField and updateField in the main store/index.js file.

@maoberlehner
Copy link
Owner

You have to use Namespaces, see #57 (comment)

@wackyapps
Copy link

wackyapps commented Dec 6, 2021

I also ran into this problem. If use store/index.js file as a store - everything is ok. But if you use store/user.js, when we call the function mapFields:

export default {
    computed: {
      ...mapFields([
        'user.phone',
        'user.password'
      ])
    }
}

we get the error: this.$store.getters[getterType] is not a function

PS. Maybe the problem is that Nuxt creates store dynamically

@maoberlehner Do i have to use this package in nuxt as plugin entry?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants