Reusable getters
See original GitHub issueIs it possible to create dynamic modules extended from some parent module? I tried it that way:
My parent-module.ts
:
import {Action, getModule, Module, Mutation, VuexModule} from 'vuex-module-decorators';
export class ParentStore extends VuexModule {
public get getterForInherit(): any {
return someData
}
}
Child modules:
child-one.ts
:
import {Action, getModule, Module, Mutation, VuexModule} from 'vuex-module-decorators'
import {ParentModule} from './parent-module';
@Module({dynamic: true, store: Store, name: 'childOne', namespaced: true})
class FirstChildModule extends ParentModule {
public get SecondChildGetter(): number {
return 1;
}
}
export const FirstChildStore: ParentModule = getModule(FirstChildModule)
child-two.ts
:
import {Action, getModule, Module, Mutation, VuexModule} from 'vuex-module-decorators'
import {ParentModule} from './parent-module';
@Module({dynamic: true, store: Store, name: 'childTwo', namespaced: true})
class SecondChildModule extends ParentModule {
public get FirstChildGetter(): number {
return 2;
}
}
export const SecondChildStore: ParentModule = getModule(SecondChildModule)
But when I import those modules to components getterForInherit
is not available. Is it possible to do it this way?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:12
Top Results From Across the Web
Creating reusable getters in vuex-module-decorators
You can use vuex if you already have it installed. You can do something like this: import { mapGetters, mapActions, mapMutations } from...
Read more >Dynamic reusable Vuex store - Medium
Use the Getter isVisible for retrieving the state value. Mutations/Actions for actual mutating of the state — showing and hiding the Modal ...
Read more >Modules | Vuex
Each module can contain its own state, mutations, actions, getters, and even nested modules - it's fractal all the way down:.
Read more >how i can create reusable javascript getters and setters?
how i can create reusable javascript getters and setters? my friend send this test to me and after i make some search ,...
Read more >Team Go Getters - P90X | Go getter, Reusable tote bags, Laundry bag
Jun 18, 2013 - This Pin was discovered by Big Frog Round Rock. Discover (and save!) your own Pins on Pinterest.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fen89 we use this: https://github.com/gertqin/vuex-class-modules
But it looks like they may have merged a fix with this package. Haven’t tested it yet.
@dan-an @rendrom This workaround may interest you.