我想在 Yii2 分页中使用 bootstrap glyphicon 图标作为上一个和下一个按钮。我已经在下面的代码中设置了他们的CSS类,但它不起作用。它显示了图标,但位置不正确,并且没有指向它的链接。
'pager' => [
'options' => ['class'=>'pagination'], // set clas name used in ui list of pagination
'prevPageLabel' => '>', // Set the label for the "previous" page button
'nextPageLabel' => '<', // Set the label for the "next" page button
'firstPageLabel' => '>>', // Set the label for the "first" page button
'lastPageLabel' => '<<', // Set the label for the "last" page button
'nextPageCssClass' => 'next', // Set CSS class for the "next" page button
'prevPageCssClass' => 'perv', // Set CSS class for the "previous" page button
'firstPageCssClass'=> 'first', // Set CSS class for the "first" page button
'lastPageCssClass' => 'last', // Set CSS class for the "last" page button
'maxButtonCount' => 10, // Set maximum number of page buttons that can be displayed
],
最佳答案
您可以使用 <span>
添加图标:
例如,
'pager' => [
'options' => ['class'=>'pagination'], // set clas name used in ui list of pagination
'prevPageLabel' => '<span class="glyphicon glyphicon-chevron-left"></span>',
'nextPageLabel' => '<span class="glyphicon glyphicon-chevron-right"></span>',
'firstPageLabel' => '<span class="glyphicon glyphicon-fast-backward"></span>',
'lastPageLabel' => '<span class="glyphicon glyphicon-fast-forward"></span>',
'nextPageCssClass' => 'next', // Set CSS class for the "next" page button
'prevPageCssClass' => 'prev', // Set CSS class for the "previous" page button
'firstPageCssClass'=> 'first', // Set CSS class for the "first" page button
'lastPageCssClass' => 'last', // Set CSS class for the "last" page button
'maxButtonCount' => 10, // Set maximum number of page buttons that can be displayed
],
关于gridview - 如何在 yii2 分页中使用 bootstrap glyphicon 图标作为上一个和下一个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36467682/