Vuex-module-decorators: How can I nest modules?

Created on 11 Sep 2018  路  3Comments  路  Source: championswimmer/vuex-module-decorators

Like this

computed: {
  ...mapState({
    a: state => state.some.nested.module.a,
    b: state => state.some.nested.module.b
  })
},
methods: {
  ...mapActions([
    'some/nested/module/foo',
    'some/nested/module/bar'
  ])
}
enhancement

Most helpful comment

This library doesn't support module inside module as of now. It is planned for future.

All 3 comments

This library doesn't support module inside module as of now. It is planned for future.

You can override static modules property in your own module to include your nested modules:

[...]
@Module({name: 'SettingsModule', store, namespaced: true})
export default class SettingsModule extends ItemListModule {

  public static modules?: ModuleTree<any> = {
    // your own nested modules:
    rowDensity,
    columnsToDisplay: SettingsModule.getColumns().getModule(),
    itemsList: new ItemsList(new SettingService(), null, false).getModule('Key'),
  };
[...]

At least works when nested modules are "traditional". Still working on it...

merge to #32

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cyberflohr picture cyberflohr  路  4Comments

farzadmf picture farzadmf  路  7Comments

BonBonSlick picture BonBonSlick  路  5Comments

Akumzy picture Akumzy  路  5Comments

davidhiendl picture davidhiendl  路  3Comments