1234567891011121314151617181920212223242526272829 |
- import {
- apiurl
- } from "./apiurl.js"
- const install = (Vue, vm) => {
- let httpMap = {}
- const http = uni.$u.http
-
-
- Object.keys(apiurl).forEach((key) => {
- if(apiurl[key]?.type=='get'){
- httpMap[key] = (data = {}, config = {}) => http[apiurl[key]?.type](apiurl[key]?.url, {params:data}, config);
- }else{
- httpMap[key] = (params = {}, config = {}) => http[apiurl[key]?.type](apiurl[key]?.url, params, config);
- }
-
- });
-
-
- vm.$u.api = {
- ...httpMap
- };
- }
- export default {
- install
- }
|