合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
框架内部已经根据公司接口api结构封装好了请求方法,可以在需要使用的地方直接调用,源码在src/assets/js/http.js 请求类方法包含两个公用方法:单个请求和并发请求 > 注意,接口配置在config目录内配置 <br> ## **单个请求example** ```javascript async created(){ try { let result = await this.$http.ajax({ url:'/goodsData', method:"post", data:{pms:1}, loading:true }); console.log('请求成功',result); }catch (e) { console.log('请求失败',e); return false; } } ``` <br> ## **并发请求example** ```javascript async created(){ try { let result = await this.$http.all({ requestArr:[ { url:'/goodsData', method:"post", data:{pms:1} },{ url:"/search", method:"post", data:{index:2} },{ url:"/integral", method:"post" }] }); console.log('请求成功',result); }catch (e) { console.log('请求失败',e); return false; } } ```