Commit 54e52773 authored by yyh's avatar yyh

proof列表是否加载完毕判断

parent 842be96b
......@@ -59,6 +59,7 @@ import SelectTemplate from '@/views/template/components/SelectTemplate.vue';
import PreviewTemplate from '@/views/template/components/PreviewTemplate.vue';
import AddFolder from '@/views/template/components/AddFolder.vue';
import AddBaseinfo from './components/AddBaseinfo.vue';
import proof from '@/api/modules/proof';
@Component({
components: {
[Picker.name]: Picker,
......@@ -87,7 +88,6 @@ export default class Index extends Mixins(MixinProof) {
private currentProof: any = {};
private list: any[] = [];
private total: number = 0;
private page: number = 1;
private loading: boolean = false;
......@@ -109,7 +109,6 @@ export default class Index extends Mixins(MixinProof) {
return ChainStatus;
}
protected resetList() {
this.total = 0;
this.list = [];
this.finished = false;
this.page = 1;
......@@ -171,17 +170,19 @@ export default class Index extends Mixins(MixinProof) {
}
private async getList() {
const { chainStatus } = this;
const pageSize = 20;
const params = {
status: Array.isArray(chainStatus) ? chainStatus : [ chainStatus ],
pageSize,
};
const res = await this.$api.proof.list(this.page++, params);
this.total = res.total;
this.list = [...this.list, ...(res.results || [])];
const currentProofList = res.results || [];
this.list = [...this.list, ...currentProofList];
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (this.list.length >= this.total) {
if (currentProofList < pageSize) {
this.finished = true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment