> 如题,在使用GET方式请求时,相传数组给到后台。需要改为filterIds=1&filterIds=2&filterIds=3
参数值:
`pageSize=15&pageNo=1&filterIds=%5B%221%22%2C%222%22%2C%223%22%5D`
后台返回的错误信息:
```
Failed to convert property value of type 'java.lang.String' to required type 'java.util.List' for property 'filterIds'; nested exception is java.lang.NumberFormatException: For input string: "["1","2","3"]"
```
解决方案:
针对GET,将参数对象转换成字符串,如果请求中参数是数组格式,则数组里每一项的属性名重复使用
```
if (options.method === 'GET') {
options.url = `${options.url}?${qs.stringify(options.data, { arrayFormat: 'repeat' })}`
delete options.data
}
```

【uniapp】 uni.request GET方式请求,不能直接传数组解决方法