vue+axios使用get请求
1 var _this = this; 2 axios.post('http://localhost:8080/login', { 3 params: { 4 user: this.user, 5 pass: this.pass 6 } 7 }).then(function (response) { 8 console.log(response); 9 if (response.status === 200 && response.data.toString() === 'success') { 10 _this.$message({ 11 message: '登录成功', 12 type: 'success' 13 }); 14 15 } else { 16 _this.$message.error('账号或密码错误!') 17 } 18 }).catch(function (err) { 19 console.log(err); 20 _this.$message.error('请求出现异常'+err.toString()) 21 });
原创文章,转载请说明出处,谢谢合作