[Vuejs]-Modify the store example to protect state

0👍

JavaScript does not support access modifiers; everything is public.

There are various ways of encapsulating private implementation details in JavaScript, but in your example the store’s state needs to be public so that it can be assigned to the component’s data.

Vuex has a strict mode which, if enabled, will throw an error if the state is modified outside of mutation handlers.

Leave a comment