axios的get方法传数组参数


var searchParams={
    pageIndex=1,
    pageSize=10,
    status:[1,3] 
}
searchParams.status = searchParams.status.toString(); //把数组转为字符串   
this.$axios.get(
    "/getTableData",
    {params:searchParams},
)
.then(res=>{
    console.log(res);
})
.catch(err=>{console.log("err")})

//所形成的url为:/getTableData?status=1,3等价于 /getUserByName?status=1&status=3

参考网址:https://blog.csdn.net/Cribug8080/article/details/88343758


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM