When there are many Vuex states, it needs to be divided into different modules, but after dividing the modules, the mutations, actions, and getters of different modules cannot have the same name, so namespaced should be introduced into the module.
commit to write like this
this.$store.commit('cart/addCart', $data);
cart is the module name
refer to
https://vuex.vuejs.org/en/modules.html#namespacing
https://segmentfault.com/q/1010000009900181/a-1020000009901235