File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ class Pagination implements \JsonSerializable
3737 protected $ disabledCssClass = 'disabled ' ;
3838 protected $ disabledTag = 'span ' ;
3939
40+ /**
41+ * @var \Closure
42+ */
43+ public static $ jsonSerializer = null ;
44+
4045 /**
4146 * 生成页码超链接
4247 *
@@ -212,12 +217,18 @@ protected function appendSuffix($url)
212217 return $ url ;
213218 }
214219
220+
215221 /**
216222 * 实现JsonSerializable接口,方便转为json时自定义数据。
217223 * @return array
218224 */
219225 public function jsonSerialize ()
220226 {
227+ if (static ::$ jsonSerializer ) {
228+ $ cb = static ::$ jsonSerializer ;
229+ return $ cb ($ this );
230+ }
231+
221232 return array (
222233 'itemCount ' => intval ($ this ->itemCount ),//总记录数
223234 'currentPage ' => intval ($ this ->currentPage ),//当前页码
You can’t perform that action at this time.
0 commit comments