在 then的内部不能使用Vue的实例化的this, 因为在内部 this 没有被绑定。
解决方法:
created() {
var self = this;
axios.post(’/api/question/follower’, {
‘question’:this.question,
‘user’:this.user
}).then(function(response){
// console.log(response.data);
self.followed = response.data.followed;
})
},
链接: https://blog.csdn.net/nihaoqiulinhe/article/details/79084755
Vue 使用axios 发送post请求,参数格式有错误问题
最新推荐文章于 2023-05-18 17:23:25 发布