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

How to create NUXT module with namespaced store #1

Open
mmoollllee opened this issue Apr 8, 2020 · 0 comments
Open

How to create NUXT module with namespaced store #1

mmoollllee opened this issue Apr 8, 2020 · 0 comments

Comments

@mmoollllee
Copy link

Hey carepenny!

Thanks for your tutorial! It already helped me to set up nuxt-protected-mailto!

Now I'm trying to create a module from this cookie control message example, I created inside a other project. So it's not a module yet, but it's working already.

I already cloned your repo to nuxt-privacy-message. But it's nowhere near functioning yet, as I just started to put some code in.

Now I'm wondering...

  1. How to integrate and activate nuxt-vuex-localstorage as a dependency? I have to tell nuxt-vuex-localstorage which directory should be saved to the browser. How do I add the following part to my module, that was in nuxt.config.js before? Or does a user have to do this manually when using my module later?
    [
      'nuxt-vuex-localstorage',
      {
        localStorage: ['cookies'],
        mode: 'debug'
      }
    ],
  1. How do I use the store right within the cookieMessage component as I did before with the following? Or do I have to create helper-plugins the way it's done in your tutorial?
$store.state.cookies.collapsed == true
// or
this.$store.commit('cookies/saveSelection', newVal)

All the best,
hope you can help me :)

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

1 participant