Parcourir la source

handle not installed case

Evan You il y a 9 ans
Parent
commit
8a0118a543
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      src/index.js

+ 5 - 0
src/index.js

@@ -35,6 +35,11 @@ class Store {
     // use a Vue instance to store the state tree
     // suppress warnings just in case the user has added
     // some funky global mixins
+    if (!Vue) {
+      throw new Error(
+        '[vuex] must call Vue.use(Vuex) before creating a store instance.'
+      )
+    }
     const silent = Vue.config.silent
     Vue.config.silent = true
     this._vm = new Vue({