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                 });
复制代码

 

posted @   勤快的懒羊羊  阅读(277)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示