首頁
社區(qū)
課程
招聘
bootstrap分頁模版文件

請問bootstrap分頁模版文件在哪里下載

收藏
1條回答
mb_mfbflsyt 6天前

在/app/common/BootStrap.php文件下,加入代碼:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
namespace app\common;
 
use think\paginator\driver\Bootstrap as BaseBootstrap;
 
class Bootstrap extends BaseBootstrap
{
    /**
     * 渲染分頁HTML
     * @return string
     */
    public function render(): string
    {
        if ($this->hasPages()) {
            return sprintf(
                '<nav><ul class="pagination justify-content-center">%s %s %s</ul></nav>',
                $this->getPreviousButton(),
                $this->getLinks(),
                $this->getNextButton()
            );
        }
 
        return '';
    }
 
    /**
     * 生成可點(diǎn)擊的頁碼按鈕
     * @param string $url
     * @param string $page
     * @return string
     */
    protected function getAvailablePageWrapper(string $url, string $page): string
    {
        return '<li class="page-item"><a class="page-link" href="' . htmlentities($url) . '">' . $page . '</a></li>';
    }
 
    /**
     * 生成禁用狀態(tài)的按鈕
     * @param string $text
     * @return string
     */
    protected function getDisabledTextWrapper(string $text): string
    {
        return '<li class="page-item disabled"><span class="page-link">' . $text . '</span></li>';
    }
 
    /**
     * 生成當(dāng)前激活的頁碼按鈕
     * @param string $text
     * @return string
     */
    protected function getActivePageWrapper(string $text): string
    {
        return '<li class="page-item active"><span class="page-link">' . $text . '</span></li>';
    }
 
    /**
     * 生成省略號(hào)
     * @return string
     */
    protected function getDots(): string
    {
        return $this->getDisabledTextWrapper('...');
    }
 
    /**
     * 上一頁按鈕
     * @param string $text
     * @return string
     */
    protected function getPreviousButton(string $text = '?'): string
    {
        if ($this->currentPage() <= 1) {
            return $this->getDisabledTextWrapper($text);
        }
 
        return $this->getAvailablePageWrapper(
            $this->url($this->currentPage() - 1),
            $text
        );
    }
 
    /**
     * 下一頁按鈕
     * @param string $text
     * @return string
     */
    protected function getNextButton(string $text = '?'): string
    {
        if (!$this->hasMore) {
            return $this->getDisabledTextWrapper($text);
        }
 
        return $this->getAvailablePageWrapper(
            $this->url($this->currentPage() + 1),
            $text
        );
    }
}
回復(fù)
【全面高效】從0到1開發(fā)AI代碼審計(jì)系統(tǒng)
  參與學(xué)習(xí)     17 人
  提問次數(shù)     1 個(gè)
從0到1開發(fā)AI代碼審計(jì)系統(tǒng);GPT結(jié)合CodeQL代碼安全審計(jì)
0
我的提問
0
我的回答
0
學(xué)習(xí)收益