Javascript TypeError:{(中间值)(中间值)}。then不是函数
我在尝试使用Axios发布时遇到了一个奇怪的错误 JS: 提交有效的电子邮件和密码时,我没有点击调试器,而是在控制台中看到此错误:Javascript TypeError:{(中间值)(中间值)}。then不是函数,javascript,vue.js,axios,Javascript,Vue.js,Axios,我在尝试使用Axios发布时遇到了一个奇怪的错误 JS: 提交有效的电子邮件和密码时,我没有点击调试器,而是在控制台中看到此错误: TypeError: {(intermediate value)(intermediate value)}.then is not a function 有人知道我做错了什么吗?为axios关闭大括号并将其对齐。post应该在之前。然后您需要将.then()移动到.post()的外部。试试这个: methods: { onSubmit: function
TypeError: {(intermediate value)(intermediate value)}.then is not a function
有人知道我做错了什么吗?为
axios关闭大括号并将其对齐。post
应该在之前。然后您需要将.then()
移动到.post()的外部。试试这个:
methods: {
onSubmit: function () {
axios.post('/user_token', {
auth: {
email: this.$refs.user_email.value,
password: this.$refs.user_password.value
}
}).then(response => {
localStorage.setItem("token", response.data.jwt)
}).catch(error => {
var err = error.response.data.errors
});
}
}
检查数组声明,以及它的二维数组是否正确,以及u是否以
var arr=新数组();
删除新数组并使用
var arr=[“1”、“A”]、[“2”、“B”] 我很确定,你需要把它移到post
的右括号外。}。然后
->})。然后
methods: {
onSubmit: function () {
axios.post('/user_token', {
auth: {
email: this.$refs.user_email.value,
password: this.$refs.user_password.value
}
}).then(response => {
localStorage.setItem("token", response.data.jwt)
}).catch(error => {
var err = error.response.data.errors
});
}
}