前端定義API的幾種傳參方式


1,

export function posterAddOrEdit({ pId, ...args }) {
return request({
url: '/poster/addOrEdit',
method: 'post',
data: {
pid: pId, ...args
}
})
}
 
2,
export function posterPosterDetail({ pId, ...args }) {
return request({
url: '/poster/posterDetail',
method: 'get',
params: {
pId,
...args
}
})
}
 
3,含有query等
export function posterList({ pageNum, pageSize, ...args }) {
return request({
url: `/poster/list`,
method: 'post',
params: {
pageNum,
pageSize
},
data: {
...args
}
})
}
 
4,formdata
export function editAccountEnable({ accountId, enabled }) {
return request({
url: '/auth/account/editAccountEnable',
method: 'post',
data: `accountId=${accountId}&enabled=${enabled}`
})
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM