ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### 1. 发起get请求 当发起get请求之后,通过 .then 来设置成功的回调函数 ``` this.$http.get('url').then(function(res){ console.log(res.body); //通过res.body 拿到服务器返回的数据 }) ``` #### 2. 发起post请求 发起post请求, application/x-wwww-form-urlencoded 手动发起的Post请求,默认没有表单格式,所以有的服务器处理不了 通过post方法的第三个参数,{ emulateJSON: true } 设置提交的内容类型为普通表单数据格式 ``` this.$http.post('url', {}, {emulateJSON: true}) .then(res=>{ console.log(res.body); }) ``` #### 3. 发起JSONP请求 ``` this.$http.jsonp('url').then(res=>{ console.log(res.body); }) ```