the official website of vuex suggests changing the data in store through commit mutation, but it is not convenient in the actual project, because there are too many states to change, and it is troublesome to write many methods to commit, so I added the path path to the state data in store through js
.
then bind the path to the tag that needs to change the state, obtain the path, when you need to change the state, and change the data state in the store through eval ("this.$store.getters.PhysicsData" + path + ".ifCollection =" + true); ). Now the effect has been achieved, but I am always in a hurry. I would like to ask all the great gods, is there any drawback in modifying store in this way?