-
post请求
请求的路径
http://localhost:9528/dev-api/admin/acl/user/save
数据格式:form对象,数据在请求体里面
![](https://img-blog.csdnimg.cn/3a595a0f00544f3497536c76afef2183.png)
![](https://img-blog.csdnimg.cn/a3eeb96cab244e39860ad88c5a7b6d79.png)
user.js文件中
export const reqAddUserInfo = (data) => request({
url: `${url}/save`,
method: 'post',
data
})
let result = await this.$API.User.reqAddUserInfo(this.form);
2.delete请求
请求路径:
http://localhost:9528/dev-api/admin/acl/user/batchRemove
数据格式:是数组,写在body里,用data接收
![](https://img-blog.csdnimg.cn/87f4c97507364eb4899f9ef36e4263a5.png)
![](https://img-blog.csdnimg.cn/940b97462ec34edaba169d99f0383929.png)
export const reqDeleteUserBatch = (data) => request({
url:`${url}/batchRemove`,
method: 'delete',
data
})
let result = await this.$API.User.reqDeleteUserBatch(this.userIdList);
3.put请求
请求路径:
http://localhost:9528//dev-api/admin/acl/user/update
数据格式:user对象,数据放到body体里面,用data接收
![](https://img-blog.csdnimg.cn/8192b251415947df8edb74a96d98836b.png)
![](https://img-blog.csdnimg.cn/1a6d4f48285a458c99d8876f0bddcc74.png)
export const reqUpdateUserName = (user) => request({
url: `${url}/update`,
method: 'put',
data:user
})
let result =await this.$API.User.reqUpdateUserName(this.user)
4.get请求
请求路径:
http://localhost:9528/dev-api/admin/acl/user/1/5
数据格式:两个字符串,直接拼到路径上
![](https://img-blog.csdnimg.cn/6819f24957bc4887968c7e97057fe209.png)
//写法一:
export const reqGetAllUserInfo = (page, limit) => request({
url:`${url}/${page}/${limit}`,
method: 'get'
})
let result = await this.$API.User.reqGetAllUserInfo(
this.currentPage,
this.pageSize
);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)