ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
框架内部已经根据公司接口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; } } ```