mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
feat:增加api接口文件配置
This commit is contained in:
8
src/api/config.js
Normal file
8
src/api/config.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import axios from "axios";
|
||||
|
||||
const http = axios.create({
|
||||
baseURL: 'http://localhost:8082/api',
|
||||
timeout: 1000 * 100
|
||||
});
|
||||
|
||||
export default http;
|
||||
20
src/api/index.js
Normal file
20
src/api/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import http from "./config";
|
||||
|
||||
// 接口
|
||||
export const getUserInfo = () => http.get('/');
|
||||
export const getUserById = (x, y, z) => http.post('/getuserbyid', { x, y, z });
|
||||
|
||||
|
||||
// 使用方法
|
||||
// import * as api from '../../api/index'
|
||||
// api.getUserById(6, 7, 8).then(res => {
|
||||
// console.log(res)
|
||||
// }).catch(err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
|
||||
// api.getUserInfo().then(res => {
|
||||
// console.log(res)
|
||||
// }).catch(err => {
|
||||
// console.log(err)
|
||||
// })
|
||||
Reference in New Issue
Block a user