分页的相关配置,只需要重写configListPagination方法
configListPagination
#project\app\admin\controller\Category.php namespace app\admin\controller; use easyadmin\app\libs\Pagination; class Category extends \easyadmin\controller\Admin { protected function configListPagination(Pagination $pagination) { } }
#project\app\admin\controller\Category.php protected function configListPagination(Pagination $pagination) { $pagination->setPageSize(1); }
#project\app\admin\controller\Category.php protected function configListPagination(Pagination $pagination) { $pagination->setOptions([ 'name'=>'php' ]); }
#project\app\admin\views\list\page.html {extend name="@list:page" /} {block name="main"} {__block__} #您的自定义内容,或者去掉{__block__},完全重写样式 {/block}
这里运用了 thinkphp 的模板继承
{extend name="@list:page" /}表示继承原来的 分页模板
{extend name="@list:page" /}
{__block__} 表示调用原来的主体内容,是 thinkphp-template 的用法
{__block__}
#project\app\admin\controller\Category.php protected function configListPagination(Pagination $pagination) { $pagination->setTemplate('page'); //$pagination->setTemplate('list:page');//同 thinkphp-template 用法相同 }
会查找project\app\admin\views\page.html 进行渲染, 模板内容同上面的模板继承
project\app\admin\views\page.html