gertqin / vuex-class-modules

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

fully support registerModule usage #60

Open ippeiukai opened 3 years ago

ippeiukai commented 3 years ago

This is a feature request.

Currently, I'm using vuex-module-decorators and looking for an alternative that supports dynamically managing multiple instances of same module definition. This is inherently impossible with vuex-module-decorators which requires module name to be specified with the @Module decorator in order to create accessor objects. Now that I found vuex-class-modules can do that (nice!), I found a couple of crucial registerModule features are not exposed by vuex-class-modules and wanted to leave a feedback.

From vuex docs:

registerModule(path: string | Array, module: Module, options?: Object) Register a dynamic module. options can have preserveState: true that allows to preserve the previous state. Useful with Server Side Rendering.

https://vuex.vuejs.org/api/#registermodule https://vuex.vuejs.org/guide/modules.html#dynamic-module-registration

Here, following features are missing from the VuexClassModuleFactory of vuex-class-modules:

I'm especially looking for the latter because we use vuex-persist plugin and need to specify preserveState for each module that are previously persisted.

Thanks!

BonBonSlick commented 2 years ago

https://github.com/gertqin/vuex-class-modules/issues/72