vue+springboot批量下载如何传参
时间: 2023-12-26 14:04:50 浏览: 95
根据提供的引用内容,可以使用get方法传输多个参数。具体实现方式有两种:
1. 后端使用实体类接收参数:
前端代码:
```javascript
let query = { id: 1, name: '小红' }
export function workMakeupList(query) {
return request({
url: '/work/makeup/list',
method: 'get',
params: query
})
}
```
后端代码:
```java
@GetMapping("/list")
public List list(Student s){
List s = null;
return s;
}
//实体
public class Student{
private Long id;
private String name;
}
```
2. 后端分别接收参数:
前端代码:
```javascript
let query = { id: 1, name: '小红' }
export function workMakeupList(query) {
return request({
url: '/work/makeup/list',
method: 'get',
params: query
})
}
```
后端代码:
```java
@GetMapping("/list")
public List list(@RequestParam("id") Long id, @RequestParam("name") String name){
List s = null;
return s;
}
```
阅读全文