vuex-pathify icon indicating copy to clipboard operation
vuex-pathify copied to clipboard

Nuxt 3 Vuex workaround

Open chiboreache opened this issue 6 years ago • 13 comments

Hi! Since Nuxt 2 already warning us about deprecating classic way of doing Vuex, so my question is:

how to make neat store.set('foo/bar') work again without import store from './store/index' ?

chiboreache avatar Jan 29 '19 22:01 chiboreache

What's their new plan?

davestewart avatar Feb 01 '19 12:02 davestewart

I asked a question here:

  • https://cmty.app/nuxt/nuxt.js/issues/c8589

davestewart avatar Feb 01 '19 12:02 davestewart

lol

you have to enabling plugins in nuxt.config.js in plugins: []

their new plan

is to make it nice and clean, obviously heh

Modules: every .js file inside the store directory is transformed as a namespaced module (index being the root module). The store will be created as such: blah-blah

go through the link above

chiboreache avatar Feb 01 '19 15:02 chiboreache

OK, so as long as the plugin's install() method is called, passing an instance of store, it should just work:

  • https://github.com/davestewart/vuex-pathify/blob/develop/src/plugin/pathify.js
  • https://github.com/davestewart/vuex-pathify/blob/develop/src/helpers/accessors.js

davestewart avatar Feb 02 '19 14:02 davestewart

@chiboreache - did you have any more info on this? Is this still an issue I need to handle?

davestewart avatar Mar 18 '19 10:03 davestewart

@davestewart I just got bogged down in routine (and python), sorru =)

but I'm finally back, and I already tired from getters and mappers, so yeah, I will dig in at this week :100:

chiboreache avatar Mar 19 '19 02:03 chiboreache

I know the feeling! (of getting bogged down)

davestewart avatar Mar 19 '19 12:03 davestewart

LOL

i fixed it.

Screenshot_20190323_163300

chiboreache avatar Mar 23 '19 13:03 chiboreache

but there is an error in 2.4 version (with 1.4 from example project all fine) and it's brakes hot-reload ~_~

so yeah, that wasn't hard, heh:

import pathify from 'vuex-pathify'
import hello from './modules/hello'

console.log('STORE FILE LOADED!')

export const plugins = [ pathify.plugin ]
export const modules = { hello }
export const actions = {
  nuxtServerInit(context, value) {
    console.log('NUXT_SERVER_INIT!')
  }
}

this is thrue Module mode index.js ;)

I can pr you fully loaded coffeescript variant, just a little bit later =)

chiboreache avatar Mar 23 '19 13:03 chiboreache

So what was the final conclusion?

Does Pathify need updates to code or docs?

davestewart avatar Apr 08 '19 14:04 davestewart

Yeah, of course it would be nice, since Nuxt going that(modules) way.

When I finally figuring out how to PR properly, I will push you coffee example ;)

chiboreache avatar Apr 08 '19 17:04 chiboreache

is this being used with NUXT? as of today. new NUXT with vue 3 is releasing today...

imranaalam avatar Oct 12 '21 08:10 imranaalam

Not sure. I'll reopen the issue...

davestewart avatar Oct 22 '21 10:10 davestewart