Skip to content

@yyx990803 yyx990803 released this Dec 16, 2016 · 592 commits to dev since this release


Module Namespacing

Thanks to the great work by @ktsn for bringing us this feature.

Modules can now be auto-namespaced by using the new namespaced: true option. The getters, actions and mutations inside a namespaced module will automatically be prefixed with a namespaced inferred from the module's registration path. For example:

  const store = new Vuex.Store({
    modules: {
      foo: {
        namespaced: true,
        // ...

The foo module will automatically get assigned the namespace foo/.

Everything inside the module are auto resolved to respect the namespace, so toggling between namespaced or not does not affect the code inside the module itself.

See updated docs for more details.

Helpers for Namespaced Modules

You can now pass a namespace string as the first argument to the mapState, mapGetters, mapActions and mapMutations helpers, so that the mappings are resolved using that module as the context:

computed: {
  ...mapState('foo', {
    // state is the state of the `foo/` module instead of root
    bar: state =>
methods: {
  ...mapActions('foo', [
    // map this.doSomething() to this.$store.dispatch('foo/doSomething')

Updated docs.

Assets 2