Commit 78b336b25b81b75885948eaaa05e78a7db23f103

Authored by Aaron
1 parent 24f07924
Exists in master and in 1 other branch legacy

修复Scheme静态数据表格初始化数量

Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
packages/scheme/index.vue
... ... @@ -384,9 +384,12 @@ export default {
384 384 watch: {
385 385 value(val) {
386 386 if (!(this.option.searchAPI || _$http && this.option.url)) {
387   - const valueData = val.map(item => { return { ...item, $pk: item[this.option.primaryKey] || item['$pk'] || getUUID() } });
388   - this.tableDataStatic = valueData;
389   - this.tableData = valueData;
  387 + const resultData = val.map(item => { return { ...item, $pk: item[this.option.primaryKey] || item['$pk'] || getUUID() } });
  388 + this.tableDataStatic = resultData;
  389 + const begin = (this.currentPage - 1) * this.pageSize;
  390 + const end = this.currentPage * this.pageSize;
  391 + this.tableData = resultData.slice(begin, end);
  392 + this.totalCount = resultData.length;
390 393 } else {
391 394 this.tableData = val;
392 395 }
... ...