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

Using with nuxt.js and vuex? #13

Open
culttm opened this issue May 31, 2018 · 2 comments
Open

Using with nuxt.js and vuex? #13

culttm opened this issue May 31, 2018 · 2 comments

Comments

@culttm
Copy link

culttm commented May 31, 2018

No description provided.

@MathieuDerelle
Copy link

just follow the README, there's nothing special about the integration in nuxt

not event an SSR problem

@MathieuDerelle
Copy link

I must correct my previous comment :
there is currently 2 ways of using vuex in nuxt

as described in the doc :

Nuxt.js lets you decide between 2 store modes. You can choose the one you prefer:

- Modules: every .js file inside the store directory is transformed as a namespaced module (index being the root module).
- Classic (deprecated): store/index.js returns a method to create a store instance.

my previous comment apply to the "classic (deprecated)" way of doing,
just follow the README and you'll get there

something like :

import { createModule } from 'vuex-toast'

new Vuex.Store({
  modules: {
    toast: createModule(),
  },
})

but for the new way (with modules), you need this hack-ish solution :

// store/toast.js
import { createModule } from 'vuex-toast'

const toast = createModule()

export const state = () => ({ ...toast.state })

export const getters = toast.getters
export const actions = toast.actions
export const mutations = toast.mutations

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

2 participants