axios

// server.js
import axios from "axios";
const $api = axios.create({
    baseURL: 'http://127.0.0.1:3000',//配置前进路径

})
export default $api

// admin.js
import $api from "./server";    
//使用 
export const addAdmin =async(参数)=>{
    let res=await $api.post ('请求路径',参数)
    return res
}
//后期使用直接导出addAmin函数发送请求

 

posted @ 2022-08-08 21:02  健生  阅读(29)  评论(0)    收藏  举报