wordpress首行不缩进,网站seo方案案例,易居房产网下载,网站推广优化c重庆Axios 是一个异步请求技术,核心作用就是用来在页面中发送异步请求,并获取对应数据在页面中渲染 页面局部更新技术 Ajax
中文网站:https://www.kancloud.cn/yunye/axios/234845
安装:
script srchttps://unpkg.com/axios/dist/axios.min.js/scriptscript srchttps://unpkg.com/axios/dist/axios.min.js/scriptGET方式的请求 //发送GET方式请求axios.get(http://localhost:8080/user/findAll?namew).then(function (responese){console.log(responese.data);}).catch(function (error){console.log(error); //请求正确的情况下没值})POST方式请求 //发送POST方式请求axios.post(http://localhost:8080/user/save,{username:w,age:23,email:123123123qq.com,phone:12332131}).then(function (resp){console.log(resp.data)}).catch(function (error){console.log(error)})axios并发请求 //1、创建一个查询所有的请求function findAll(){return axios.get(http://localhost:8989/user/findAll?name阿昌);}//2、创建一个保存的请求function save(){return axios.post(http://localhost:8989/user/save,{username:achang,age:23,email:995931576qq.com,phone:165534841});}//3、并发执行axios.all([findAll(),save()]).then(axios.spread(function (resp1,resp2){ //【.spread】 用来将一组函数的响应结果汇总处理回调函数的结果会以顺序放在参数1/2/3...console.log(resp1.data);console.log(resp2.data);})); //【.all】用来发送一组并发请求