后端post 请求要求在 url 上携带参数,各种百度,最后发现了一种可行的方式,用formData对象构造请求参数,然后用URLSearchParams 把formdata 参数转换成键值对,最后发送
- function getList() {
-
- const formdata = new FormData()
- formdata.append("pageNum", queryParams.value.pageNum);
- formdata.append("pageSize", queryParams.value.pageSize);
-
- const params = new URLSearchParams(formdata)
-
- jfList(params).then(res => {
- tableData.value = res.data.list
- total.value = res.data.total
- })
- }
-
-
-
-
- /接口请求发送方式
-
- export function jfList(query) {
- return request({
- url: '/charge/payment/list',
- method: 'post',
- params: query,
- })
- }