SoFunction
Updated on 2025-04-03

A brief discussion on the namespace of store in vuex

In order to prevent the store from becoming too bloated, we can register modules for the store. The module belongs to the global namespace by default. That is to say, when the action is distributed with the following code, any module will be executed as long as there is addNews in the action.

 this.$('addNews')

Sometimes this situation is not what we want. For this reason, we can specify a namespace for the module, which is equivalent to encapsulating it, so that the addNews function in the module with the namespace will not be executed.

Of course, you can also specify that the module located in a specific namespace execute the addNews function, the method is as shown below

this.$('Module name/addNews')

The above article briefly talks about the namespace of the store in vuex is all the content I share with you. I hope you can give you a reference and I hope you can support me more.