vue-axios
2018-09-18 本文已影响0人
vzii
1.引进axios
import axios from 'axios'
2.配置默认基准路径
axios.defaults.baseURL = 'http://127.0.0.1:3000'
1.get请求(没参数)
export const RootLogin = () => {
return axios.get('/employee/checkRootLogin').then((res) => {
return res
})
}
2.get请求(两个参数,以对象的形式)
export const User = (pa) => {
return axios.get('/user/queryUser', {params: pa}).then((res) => {
return res
})
}
3.post请求(两个参数,登录接口)
export const Login = (logoForm) => {
return axios.post('employee/employeeLogin', logoForm).then((res) => {
return res
})
}
4.post请求(一个参数)
export const addCategory = (pa) => {
return axios.post('/category/addTopCategory', {categoryName: pa}).then((res) => {
return res
})
}