【发布时间】:2019-05-05 17:12:09
【问题描述】:
好的,所以我使用 Laravel 的 api 资源分页,它给了我如下结构:
{
current_page: 1,
data: [
{
some data
},
{
somedata
}
],
first_page_url: "http://localhost:8000/api/accommodation?page=1",
from: 1,
last_page: 3,
last_page_url: "http://localhost:8000/api/accommodation?page=3",
next_page_url: "http://localhost:8000/api/accommodation?page=2",
path: "http://localhost:8000/api/accommodation",
per_page: 2,
prev_page_url: null,
to: 2,
total: 5
}
现在,如果我想为我的 api 编写一个过滤器来搜索其中的内容,并且我想在所有 api 中搜索而不仅仅是第一页,该怎么做呢?我应该将所有内容存储在 vuejs 中还是进行反应然后过滤,或者有什么方法可以读取所有数据,甚至我不应该使用 laravel 分页,因为它可能会给前端带来麻烦?
【问题讨论】:
-
将搜索参数发送到您的 api 并让它为您过滤结果。
-
是的@RossWilson,但我怎样才能阅读下一页?和以前的页面