我有一个函数:
getBooks(page, count, authorId){
return API.get('/books/?page=' +page + '&count='+count+ '&author='+ authorId})
.then(response => {
return response.data
})
}
我正在实现搜索功能,在搜索中我只传递
authorId
,例如:
getBooks(akdjh23)
但是这样做会将akdjh23
设置为页面page
。即page=akdjh23
,但我想要的是authorId=akdjh23
。我的问题是,如何在搜索期间只发送
authorId
,并在一般的获取请求中发送page
和count
。
基于id的搜索:
getBooks(id)
获取所有图书:
get(1, 40) -> page=1, count=40
getBooks
吗? - Addis}
afterauthorId}
- brk