This commit is contained in:
2023-10-24 17:22:29 +08:00
parent b0e627c4fb
commit dcf4e0a614
12 changed files with 11 additions and 27 deletions
+4 -9
View File
@@ -54,8 +54,8 @@ class Pagination extends Component
{
unset($this->activeQuery, $this->_callback, $this->_group);
$this->_offset = 0;
$this->_limit = 100;
$this->_max = 0;
$this->_limit = 100;
$this->_max = 0;
$this->_length = 0;;
}
@@ -196,14 +196,9 @@ class Pagination extends Component
if ($this->_max > 0 && $this->_length + $this->_limit > $this->_max) {
$this->_limit = $this->_length + $this->_limit - $this->_max;
}
$data = $this->activeQuery->offset($this->_offset)->limit($this->_limit)->get();
$data = $this->activeQuery->offset($this->_offset)->limit($this->_limit)->get();
$this->_offset += $this->_limit;
if (is_array($data)) {
$size = count($data);
} else {
$size = $data->size();
}
$size = $data->size();
$this->_length += $size;
return [$size, $data];
}