优化 table 的 `data` 模式在未开启 `page` 时可不受 `limit` 属性限制

pull/1210/head
贤心 2023-03-10 13:26:28 +08:00
parent c968ab358d
commit cc2c14f652
1 changed files with 6 additions and 3 deletions

View File

@ -987,10 +987,13 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){
}
});
} else if(layui.type(options.data) === 'array'){ //已知数据
var res = {}
,startLimit = curr*options.limit - options.limit
var res = {};
var startLimit = curr*options.limit - options.limit;
var newData = options.data.concat();
res[response.dataName] = options.data.concat().splice(startLimit, options.limit);
res[response.dataName] = options.page
? newData.splice(startLimit, options.limit)
: newData;
res[response.countName] = options.data.length;
//记录合计行数据