1.0.0 • Published 1 year ago

belovedrequest v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

npm install belovedRequest 集成axios二次封装 import {belovedRequest} from 'belovedRequest' 案例结合cache包使用 belovedRequest.request({ 可传入基本的请求数据 method data 等 可传入配置对象interceptors为每一个请求准备个性的拦截器 他们都是可选的 interceptors: interceptors: { requestInterface: (config) => { return config; }, //响应成功后的处理业务 responseInterface: (config: any) => { if (config.result.status == 1) { setCache("token", config.result.token); ElMessage({ message: config.result.message, type: "success", duration: 3000, }); // router.replace("main"); } else { ElMessage({ message: config.result.message, type: "error", duration: 3000, }); } return config; }, }, })