>npm安装axios ``` npm install axios --save ``` >要使用的地方引入 模块,不支持request引入 ~~~ import axios from 'axios'; ~~~ >具体使用 component.ts ~~~ public axiosGet(){ let api='http://www.mxact.com/v1/gateway/core/commonweal/tencent_gj_url'; axios.get(api).then(function (res) { console.log(res); }).catch(function (error) { console.log(error); }) } public axiosPost(){ let api='http://www.mxact.com/v1/gateway/core/commonweal/tencent_gj_url'; axios.post(api,{url:"http://www.baidu.com"}).then(function (res) { console.log(res); }).catch(function (error) { console.log(error); }) } ~~~