query传参指的是将参数直接放到url后面,以问号“?”开始,“&”连接
比如:
{
"name": "cherry",
"gender": "female",
}
转化为
url?name=cherry&gender=female
具体的方式如下:
//获取故障事件类型List
export function getEventTypeList(query){
return http({
url: 'api/event/getEventTypeList',
method: "GET",
params: query,
})
}
调取接口的方法如下
let data = {
"name": "cherry",
"gender": "female",
}
getEventTypeList(data).then(res => {
//todo
}).catch(err => {})
到浏览器中显示的结果如下
image.png
网友评论