vue.js - .then(Response => SyntaxError: Unexpected token ., in Vue js
问题描述
我目前正在学习 Vue 并学习 Udemy 课程。然而,我的空 Vue 项目在符号上比我的老师更严格一些。因此,当我试图弄清楚这一切时,我有时也会遇到意外的令牌错误。
我真的不明白为什么我会在 .then 上收到意外的令牌错误。这可能是一件非常简单的事情,我还不认为这是一个错误。
我检查了所有内容以查看是否所有内容都有结束标签、逗号和分号。
actions: {
signIn({ commit }, payload) {
Vue.http.post(`${FbAuth}/verifyPassword?key=${FbApiKey}`, {
...payload,
returnSecureToken: true,
}),
.then( response => response.json())
.then( authData => {
console.log(authData);
}),
},
},
它应该通过登录操作并检查我的 firebase 数据库以获取所需的凭据。
解决方案
点之前有一个逗号。
试试下面的代码:
actions: {
signIn({ commit }, payload) {
Vue.http.post(`${FbAuth}/verifyPassword?key=${FbApiKey}`, {
...payload,
returnSecureToken: true,
})
.then( response => response.json())
.then( authData => {
console.log(authData);
}),
},
},
推荐阅读
- python - Beautiful Soup 获得 td 类的数量
- python - 我怎样才能使游戏中的每个“金币”都引用 Python 迷宫游戏中的不同问题?
- powerbi - 如何在层次结构中汇总孩子的百分比?
- amazon-web-services - 从 kubernetes pod 获取 HTTP 请求日志?(运行 JupyterHub)
- javascript - 同一服务器上的相同文件。每个域的加载速度不同。为什么?
- jmeter - 正则表达式 - 无法捕获边界
- html - 为什么我的搜索按钮在我的搜索栏下方
- r - ggpubr (stat_compare_means) 中是否有一种方法可以在假设方差相等的情况下运行测试比较(而不是 R 默认 Welch 的 t 检验)
- python - Python:如何确定可以精确表示哪些浮点值并在不可以时发出警告?
- mysql - 如何使用带条件的 JOIN