Merge branch 'new-20250827' of http://47.107.152.87:3000/liubiao/APP into new-20250827
This commit is contained in:
@ -360,29 +360,24 @@
|
|||||||
this.loadedCount = 0; // 重置计数
|
this.loadedCount = 0; // 重置计数
|
||||||
console.log(`第1页加载 - 总数据量: ${this.total}`);
|
console.log(`第1页加载 - 总数据量: ${this.total}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newDevices = res.rows.map(device => ({
|
const newDevices = res.rows.map(device => ({
|
||||||
...device,
|
...device,
|
||||||
showConfirm: false
|
showConfirm: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 累加已加载数量
|
|
||||||
this.loadedCount += newDevices.length;
|
this.loadedCount += newDevices.length;
|
||||||
console.log(`第${this.page}页加载 - 新增: ${newDevices.length}, 累计: ${this.loadedCount}`);
|
console.log(`第${this.page}页加载 - 新增: ${newDevices.length}, 累计: ${this.loadedCount}`);
|
||||||
|
// 数据累加
|
||||||
// 数据累加逻辑(第一页替换,其他页追加)
|
|
||||||
if (this.page === 1) {
|
if (this.page === 1) {
|
||||||
this.deviceList = newDevices;
|
this.deviceList = newDevices;
|
||||||
} else {
|
} else {
|
||||||
this.deviceList = [...this.deviceList, ...newDevices];
|
this.deviceList = [...this.deviceList, ...newDevices];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关键:正确判断是否加载完成
|
// 关键:正确判断是否加载完成
|
||||||
if (this.loadedCount >= this.total || newDevices.length < this.size) {
|
if (this.loadedCount >= this.total || newDevices.length < this.size) {
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
console.log(`加载完成 - 已加载${this.loadedCount}/${this.total}`);
|
console.log(`加载完成 - 已加载${this.loadedCount}/${this.total}`);
|
||||||
} else {
|
} else {
|
||||||
this.page++; // 只有还有数据时才增加页码
|
this.page++;
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user