gertqin / vuex-class-modules

Typescript class decorators for vuex modules
MIT License
193 stars 20 forks source link

Does it work with typescript module libs like vuex-class-modules? #31

Closed pancake-boy closed 4 years ago

pancake-boy commented 4 years ago

the modules are dynamically loaded, nothing is being saved.

import { VuexModule, Module, Mutation, Action } from 'vuex-class-modules';
import store from '@/store';
@Module
export default class QuoteModule extends VuexModule {
}
export const quoteModule = new QuoteModule({ store, name: 'quote' });

const vuexLocal = new VuexPersistence({
  storage: window.localStorage,
  modules: ['quote'],
});

export default new Vuex.Store({
  strict: true,
  /*
  Ideally if all your modules are dynamic
  then your store is registered initially
  as a completely empty object
  */
  plugins: [vuexLocal.plugin],
});
bodograumann commented 4 years ago

Not sure what you are asking @pancake-boy. Could you please elaborate? Your code seems weird. You are importing a store from @/store, but then creating a new independent store and exporting that.

pancake-boy commented 4 years ago

thats to create an instance and register it into the store

pancake-boy commented 4 years ago

i'm gonna try switching to vuex-module-decorators and see how that goes

bodograumann commented 4 years ago

Feel free to reopen when you want to go into more detail.

BonBonSlick commented 2 years ago

@pancake-boy @bodograumann hello, tell me pelase have you figured out how to persist state for this package with dynamic modules? Thanks.