Browse Source

throw error when user tries to replace root state

Evan You 9 years ago
parent
commit
7afede5d06
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/index.js

+ 4 - 0
src/index.js

@@ -40,6 +40,10 @@ export default class Vuex {
     return this._vm._data
     return this._vm._data
   }
   }
 
 
+  set state (v) {
+    throw new Error('[vuex] Vuex root state is read only.')
+  }
+
   /**
   /**
    * Dispatch an action.
    * Dispatch an action.
    *
    *