doT.js模板和pagination分頁應用


doT.js模板和pagination分頁應用

博客中模擬了數據加載初始化的過程。
doT.js渲染每一項內容的數據項。示例如下:

<script id="Messtmpl" type="text/x-dot-template"> 
    {{~it.bean:value:index }}
    <div class="MessListItem {{?value.read}}on{{?}}" mid="{{=value.id}}">
        <strong>{{=value.title}}</strong>
        <div class="words cls">
            <p>{{=value.message}}</p>
            <label>{{=value.time}}</label>
        </div>
        <a class="closed">X</a>
    </div>
    {{~}}
</script>



pagination分頁插件的使用,示例如下:

MessPage.pagination(total, {
    callback: initPage, 
    prev_text: "«",
    next_text: "»",
    items_per_page: pageSide, 
    num_edge_entries: 1, 
    num_display_entries: 10, 
    current_page: current
});

參數說明:
callback:回調方法,點擊分頁按鈕的時候執行。
prev_text:上一頁按鈕中的文字顯示內容。
next_text:下一頁按鈕中的文字顯示內容。
items_per_page: 每一頁中顯示的條數。
num_edge_entries:首尾兩側分頁的條數。
num_display_entries:分頁主體顯示的條數。
current_page:: 當前頁數。


DEMO:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM