django - Django - DRF 中的分页在 VueJS 中返回错误
问题描述
目前我在我的 JS 文件中使用 Vue 来使用我的 DRF API。现在当我添加时;
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100
在控制台中,正在返回错误;它说;
[Vue warn]: Error in render: "TypeError: status is null"
(found in <Root>)
TypeError: "status is null"
在HTML中:
<select class="form-control" v-model="newJobRequest.status_of_the_job_request" required >
<option v-for="status in statusOfTheJobRequests">[[status.type_of_status]]</option>
</select>
在JS中:
getStatusOfJobRequest: function() {
this.loading = true;
this.$http.get(/api/v1/status-of-the-job-request/).then((response) => {
this.statusOfTheJobRequests = response.data;
this.loading = false;
}).catch((err) => {
this.loading = false; console.log(err);
})
}
由于这个错误,我无法在表格中建立分页。我也在我的用例中使用了 DataTables,但由于这个错误,我无法继续并恢复到原始状态。在可浏览的 API 中,分页没有任何问题。过去两天我一直在寻找答案,但没有发现任何类似的问题,afaik。
解决方案
推荐阅读
- regex - 正则表达式检测和替换具有重复捕获组的行以删除 pip requirements.txt 文件中的重复包
- python - 如何为我的 heroku 应用程序创建远程数据库
- reactjs - 是否有一个调试工具可以知道什么 LoC 正在改变你在 React 中的 prop/state?
- haskell - 为什么这段代码在使用 parsec 时会产生解析异常,但在 Graham Huttons 简单示例库中却没有?
- python - 将打印输出保存到图中
- c# - InvalidOperationException 不正确的内容类型:
- firebase - 找不到正确的提供者
- > 在此 CustomerHomePage 小部件上方
- angular - 状态响应:404 Not Found with post request
- laravel - Laravel - Algolia:多个搜索位置
- flutter - Flutter-如何不一遍又一遍地调用同一个服务?