Vuex 报错this.$store.commit is not a function

997 阅读1分钟

在mutation中提交时发生的错误

报错信息:this.$store.commit is not a function

问题:

在store.js创建时没有使用Vuex.store创建实例

错误写法:

const store = {}

正确写法:

const store = Vuex.Store({})

总结:

不细心!!!!