类星体框架数据表 laravel 服务器分页不起作用

quasar framework datatable laravel server pagination doesn't work

我只希望数据表的分页工作,我在这里使用文档中的代码是:

request ({ pagination }) {
            // we set QTable to "loading" state
            this.loading = true

            // we do the server data fetch, based on pagination and filter received
            // (using Axios here, but can be anything; parameters vary based on backend implementation)

            axios
                .get(`/api/`+this.dataSource+`/?page=${pagination.page}`,{ headers: { Authorization: 'Bearer '.concat(localStorage.getItem('token')) } })
                .then(response => {
                    // updating pagination to reflect in the UI
                    this.serverPagination = pagination

                    // we also set (or update) rowsNumber
                    this.serverPagination.rowsNumber = response.data.data.data.rowsNumber

                    // then we update the rows with the fetched ones
                    this.tableData = response.data.data.data

                    // finally we tell QTable to exit the "loading" state
                    this.loading = false
                })
                .catch(error => {
                    // there's an error... do SOMETHING

                    // we tell QTable to exit the "loading" state
                    this.loading = false
                })
        }

并在 laravel api 中使用了此代码

`/api/`+this.dataSource+`/?page=${pagination.page}`,{ headers: { Authorization: 'Bearer '.concat(localStorage.getItem('token')) } }

它 returns 第一页的数据,但数据表的箭头按钮被禁用,尽管存在其他数据。

提前致谢

我在这里找到了解决方案

request ({ pagination }) {
            this.loading = true
            axios
            .get(`/api/`+this.dataSource+`?page=${pagination.page}`, { headers: { Authorization: 'Bearer '.concat(localStorage.getItem('token')) } })
            .then(({ data }) => {
                this.serverPagination = pagination
                this.tableData = data.data.data
                this.serverPagination.rowsNumber = data.data.total
                this.loading = false
            })
            .catch(error => {
                // there's an error... do SOMETHING
                console.log(error)
                // we tell QTable to exit the "loading" state
                this.loading = false
            })
        }

在控制器中:

$any_data = $this->dataRepo->paginate(5);