我在使用 vue 和 Laravel 时遇到了 axios(函数?)问题。我有一个简单的警报('something')运行 - 不使用axios,只是函数中的警报)但是我在运行当前代码时遇到这些错误
POST http://127.0.0.1:8000/follow/2 500 (Internal Server Error)
dispatchXhrRequest @ xhr.js?b50d:178
xhrAdapter @ xhr.js?b50d:12
dispatchRequest @ dispatchRequest.js?5270:52
Promise.then (async)
request @ Axios.js?0a06:61
Axios.<computed> @ Axios.js?0a06:86
wrap @ bind.js?1d2b:9
followUser @ FollowButton.vue?618e:17
invokeWithErrorHandling @ vue.common.dev.js?4650:1859
invoker @ vue.common.dev.js?4650:2184
original._wrapper @ vue.common.dev.js?4650:7543
我的代码
methods: {
followUser() {
axios.post('/follow/' + this.userId)
.then(response => {
alert(response.data);
});
}
}
我在 3:28:10 关注本教程 https://www.youtube.com/watch?v=ImtZ5yENzgE,但我看不出我这辈子哪里出了问题。非常感谢任何帮助。
答案 0 :(得分:0)
我只需要包含我的 User 类 - 烦人