浏览代码

handle not installed case

Evan You 9 年之前
父节点
当前提交
8a0118a543
共有 1 个文件被更改,包括 5 次插入0 次删除
  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({