【发布时间】:2020-03-14 23:41:52
【问题描述】:
我想通过对象传递 Vue 表单数据,但是当我传递数据时它会抛出错误
SyntaxError: E:...\js\frontend\Profile.vue: Unexpected token, expected "," (251:4)
这是我的代码
export default {
props : [
'user'
],
methods : {
profile() {
axios
.put(`/web/me`, {
user.firstName : this.user.firstName,
user.lastName : this.user.lastName,
profile.code : this.user.profile.code,
})
.then((e) => {
window.location.href = '/profile';
})
.catch((e) => {
this.errors = e.response.data.errors;
})
},
}
}
我找不到发送它的方法。提前致谢
【问题讨论】:
-
您的json文件不正确,请去掉
profile.code : this.user.profile.code,最后的逗号 -
@RaminRezazadeh 已经尝试但没有成功