Vuex(vuex-typex)突然抛出未知的动作类型

时间:2019-03-30 02:00:20

标签: typescript vuejs2 vuex vuex-modules

我很难理解我的问题。我过去曾经体验过它,但不记得我是如何摆脱它的。再一次,我什至没有碰到任何与商店相关的代码,就突然遇到了[vuex] unknown action type: attributes/getAttributes错误。可能我在npm package / package-lock.json发生之前重新添加了它,但这只是一个猜测,因为我不知道其他任何可能从根本上改变的东西。以相同方式设置的所有其他商店模块都可以正常工作,而在任何内容上都没有任何明显的差异。

控制台记录对象attributesDispatch,我们将看到其中包含的函数:

loadData() {
    console.log(attributesDispatch) // #1
    attributesDispatch.getAttributes() // #2
}

导致

#1

{ getAttributes: ƒ }

getAttributes: ƒ (payload)
// contents:
arguments: (...)
caller: (...)
length: 1
name: ""
prototype: {constructor: ƒ}
__proto__: ƒ ()
[[FunctionLocation]]: index.js?fb46:86
[[Scopes]]: Scopes[5]
0: Closure (ModuleBuilderImpl.dispatch) {_this: ModuleBuilderImpl, namespacedKey: "attributes/getAttributes"}
1: Closure {ModuleBuilderImpl: ƒ}
2: Closure {__extends: ƒ, __assign: ƒ, vuex_1: Module, useRootNamespace: {…}, qualifyKey: ƒ, …}
3: Closure (./node_modules/vuex-typex/dist/index.js) {__webpack_require__: ƒ, exports: {…}, module: {…}, arguments: Arguments(3)}
4: Global {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window, …}

#2

[vuex] unknown action type: attributes/getAttributes

有什么想法可以继续解决这个问题吗?它可能与vuex-typex有关-另一方面,我不知道为什么它应该如此,因为它以前一直可以工作,而且仍然可以用于我的其他商店模块。

非常感谢您的帮助和提示!

0 个答案:

没有答案