且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

类型错误:无法读取未定义的属性“getter"

更新时间:2022-05-08 21:27:13

这里的getter"没有正确分配:

The "getters" here is not properly assigned:

  beforeEach(() => {
    getters: {
      isLoggedIn: () => false
    }

    store = new Vuex.Store({
      getters
    })
  })

它应该是 getters = {... 而不是 getters: {... 因为你对 beforeEach 的参数是一个函数而不是一个对象.

It should be getters = {... rather than getters: {... because your argument to beforeEach is a function and not an object.

我可以确认它确实在文档中正确写入.

I can confirm that it is indeed correctly written in the documentation.

祝你好运!