【发布时间】:2020-06-07 09:53:18
【问题描述】:
Uncaught TypeError: Object(...) is not a function
at eval (Auth.vue?7df1:27)
这是我的错误。
linter 没有给出任何错误,我看不到任何错误。 Devtools 说方法是对象类型,因此不能作为函数调用。
真的不知道这里发生了什么。
methods: {
submitForm: () => {
this.login(this.userData)
.then((response) => {
// eslint-disable-next-line
console.log(response);
this.$router.push('/');
})
.catch((error) => {
// eslint-disable-next-line
console.log(error);
});
},
...mapActions(['login']),
【问题讨论】:
-
我怀疑
this是否可以使用箭头函数,您可能需要使用通常的function声明它 -
所以我将错误缩小到
...mapActions后面的the method块内。
标签: javascript vue.js axios frontend