Armour / vue-typescript-admin-template

🖖 A vue-cli 3.0 + typescript minimal admin template
https://armour.github.io/vue-typescript-admin-template
MIT License
5.56k stars 1.75k forks source link

代码报错 Error: ERR_ACTION_ACCESS_UNDEFINED: Are you trying to access this.someMutation() or this.someGetter inside an @Action? #114

Open EatherToo opened 4 years ago

EatherToo commented 4 years ago
Uncaught (in promise) Error: ERR_ACTION_ACCESS_UNDEFINED: Are you trying to access this.someMutation() or this.someGetter inside an @Action? 
That works only in dynamic modules. 
If not dynamic use this.context.commit("mutationName", payload) and this.context.getters["getterName"]
Error: Could not perform action Login
    at Store.eval (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:334:37)
    at step (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:114:23)
    at Object.eval [as throw] (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:95:53)
    at rejected (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:86:65)
Error: timeout of 5000ms exceeded
    at createError (webpack-internal:///./node_modules/axios/lib/core/createError.js:16:15)
    at XMLHttpRequest.handleTimeout (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:89:14)
    at Store.eval (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:328:35)
    at step (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:114:23)
    at Object.eval [as throw] (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:95:53)
    at rejected (webpack-internal:///./node_modules/vuex-module-decorators/dist/esm/index.js:86:65)
eval @ index.js?6fc5:321
step @ index.js?6fc5:107
eval @ index.js?6fc5:88
rejected @ index.js?6fc5:79
XMLHttpRequest.send (async)
dispatchXhrRequest @ xhr.js?b50d:172
xhrAdapter @ xhr.js?b50d:11
dispatchRequest @ dispatchRequest.js?5270:59
Promise.then (async)
request @ Axios.js?0a06:53
wrap @ bind.js?1d2b:9
login @ users.ts?3aca:10
_callee$ @ user.ts?32b0:15
tryCatch @ runtime.js?96cf:62
invoke @ runtime.js?96cf:296
prototype.<computed> @ runtime.js?96cf:114
asyncGeneratorStep @ asyncToGenerator.js?3b8d:5
_next @ asyncToGenerator.js?3b8d:27
eval @ asyncToGenerator.js?3b8d:34
F @ _export.js?63b6:36
eval @ asyncToGenerator.js?3b8d:23
Login @ user.ts?32b0:15
eval @ index.js?6fc5:300
step @ index.js?6fc5:107
eval @ index.js?6fc5:88
eval @ index.js?6fc5:81
__awaiter @ index.js?6fc5:77
action @ index.js?6fc5:290
wrappedActionHandler @ vuex.esm.js?2f62:747
dispatch @ vuex.esm.js?2f62:438
boundDispatch @ vuex.esm.js?2f62:332
eval @ index.js?6fc5:195
step @ index.js?6fc5:107
eval @ index.js?6fc5:88
eval @ index.js?6fc5:81
__awaiter @ index.js?6fc5:77
statics.<computed> @ index.js?6fc5:192
handleLogin @ index.vue?3782:115
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1854
invoker @ vue.runtime.esm.js?2b0e:2179
original._wrapper @ vue.runtime.esm.js?2b0e:6917
Show 9 more frames

![Uploading image.png…]()

EatherToo commented 4 years ago

这看起来像是一个bug,vuex-module-decorator 默认会包装 module 里的错误,把原来的错误替换掉了 championswimmer/vuex-module-decorators#86

imoyao commented 3 years ago

这个问题怎么解决的呢?登录的时候也遇到这个错误了。是要加{ rawError: true }吗?加在哪里?#6 #106