欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Laravel框架自定義分頁(yè)樣式操作示例

 更新時(shí)間:2020年01月26日 10:56:00   作者:echo曦  
這篇文章主要介紹了Laravel框架自定義分頁(yè)樣式操作,結(jié)合實(shí)例形式詳細(xì)分析了laravel框架自定義分頁(yè)樣式的具體操作步驟、實(shí)現(xiàn)方法及相關(guān)注意事項(xiàng),需要的朋友可以參考下

本文實(shí)例講述了Laravel框架自定義分頁(yè)樣式操作。分享給大家供大家參考,具體如下:

操作步驟如下:

(1)  對(duì)應(yīng)public/css/paging.css 文件建立分頁(yè)樣式.

(2)  控制器查出分頁(yè)數(shù)據(jù)使用 paginate函數(shù)進(jìn)行分頁(yè)處理.(禁止使用group by處理查詢).

(3) 對(duì)應(yīng)視圖引入分頁(yè)樣式.

例如: paging.css 樣式文件代碼(復(fù)制即可用,實(shí)際操作過(guò))如下

  #pull_right{
    text-align:center;
  }
  .pull-right {
    /*float: left!important;*/
  }
  .pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
  }
  .pagination > li {
    display: inline;
  }
  .pagination > li > a,
  .pagination > li > span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    color: #428bca;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
  }
  .pagination > li:first-child > a,
  .pagination > li:first-child > span {
    margin-left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
  }
  .pagination > li:last-child > a,
  .pagination > li:last-child > span {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
  }
  .pagination > li > a:hover,
  .pagination > li > span:hover,
  .pagination > li > a:focus,
  .pagination > li > span:focus {
    color: #2a6496;
    background-color: #eee;
    border-color: #ddd;
  }
  .pagination > .active > a,
  .pagination > .active > span,
  .pagination > .active > a:hover,
  .pagination > .active > span:hover,
  .pagination > .active > a:focus,
  .pagination > .active > span:focus {
    z-index: 2;
    color: #fff;
    cursor: default;
    background-color: #428bca;
    border-color: #428bca;
  }
  .pagination > .disabled > span,
  .pagination > .disabled > span:hover,
  .pagination > .disabled > span:focus,
  .pagination > .disabled > a,
  .pagination > .disabled > a:hover,
  .pagination > .disabled > a:focus {
    color: #777;
    cursor: not-allowed;
    background-color: #fff;
    border-color: #ddd;
  }
  .clear{
    clear: both;
  }

例如:TestCntroller.php 控制器示例寫法

<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class TestController extends Controller{
  /**
   * 測(cè)試數(shù)據(jù)
   */
  public function index()
  {
    $test = DB::table('test')->paginate(5);
    return view('index', ['test' => $test]);
  }
}

例如: list.blade.php 視圖文件代碼示例寫法

<!--用于引用css-->
<link rel="stylesheet" type="text/css" href="{{asset('css/paging.css')}}" rel="external nofollow" />
<div class="container">
  <!--查數(shù)據(jù)-->
  @foreach ($test as $value)
    {{ $value->id }}
  @endforeach
</div>
<div id="pull_right">
  <!--分頁(yè)寫法-->
  <div class="pull-right">
    {{ $test->render() }}
  </div>
</div>

樣式如下圖:

更多關(guān)于Laravel相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Laravel框架入門與進(jìn)階教程》、《php優(yōu)秀開發(fā)框架總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《php+mysql數(shù)據(jù)庫(kù)操作入門教程》及《php常見數(shù)據(jù)庫(kù)操作技巧匯總

希望本文所述對(duì)大家基于Laravel框架的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論