必须区分 params
和 data
参数,请勿弄混了get
和 post
的参数
(get
—> params
)
(post
—> data
)
GET 方法参数:
前端vue api接口 xxx.js
get方法模板演示:
export function test(query) {
return request({
url: '/test/detail',
method: 'get',
params: query
})
}
POST 方法参数:
前端vue api接口 xxx.js
post方法模板演示:
export function test(data) {
return request({
url: '/test/detail',
method: 'post',
data: data
})
}