in the process of adding, deleting, changing and querying, click the query button to send the request to the backend. The backend cannot accept the parameters passed by the front end
the URLSearchParams
method
code is as follows:
export default {
name: "add",
data() {
return {
bookData: [],
filters: {
author: "",
},
total: 0,
pageSize: 0,
currentPage: 1,
listLoading: false,
dialogCreateVisible: false,
addFormLabelWidth: "80px",
addLoading: false,
}
},
methods: {
//
handleCurrentChange(val) {
this.currentPage = val;
this.getUsers();
},
//
handleSizeChange(val) {
this.pageSize = val;
},
//
getUsers() {
let para = new URLSearchParams();
para.append("authors", this.filters.author);
this.listLoading = true;
this.$ajax({
methods: "post",
url: url+"/InfoManage/bookListByTAP",
data: para ,
}).then(res => {
this.total = res.data.length;
this.pageSize = 20; //
this.bookData = res.data;
this.listLoading = false;
console.log(res.data);
console.log(":"+this.filters.authors);
}).catch( err => {
console.log(err);
})
},
mounted() {
this.getUsers();
}
}
if you interact with each other in front and back in this way, you can pass the parameters, but I don"t know why, when querying, the parameters can"t be passed successfully. Can anyone help me answer the questions?