How to get all registered Vuex modules

Viewed 589

Is there any way to iterate over all Vuex modules? I registered my namespaced modules like this:

$store.registerModule('module-xyz', module);

Now is there any way to get the list of all of them?

1 Answers

It's undocumented, but you can get all modules through the _modules property:

console.log(this.$store._modules.root._children);

You can also check for the existence of a module with hasModule:

console.log(this.$store.hasModule('module-xyz'));
Related