pagination
清單畫面 一般嘅清單畫面:標題、工具列同行,喺桌面同手機都用得。
一排有編號嘅普通連結,所以熄咗 JavaScript 都仲揭到頁。
每個例子都真係用得,不過入面啲連結唔會帶你去邊度。 HTML 顯示可以複製嘅標記。
長清單嘅中間
<nav rst-pagination aria-label ="文章分頁" >
<a href ="/posts?page=3" rst-pagination-step ="prev" ><svg class ="icon" viewBox ="0 0 24 24" fill ="none" stroke ="currentColor" stroke-width ="2" stroke-linecap ="round" stroke-linejoin ="round" aria-hidden ="true" ><path d ="m6 9 6 6 6-6" /></svg ><span rst-pagination-word >上一頁</span ></a >
<a href ="/posts?page=1" >1</a >
<span rst-pagination-gap aria-hidden ="true" >…</span >
<a href ="/posts?page=3" rst-pagination-wide >3</a >
<span aria-current ="page" >4</span >
<a href ="/posts?page=5" rst-pagination-wide >5</a >
<span rst-pagination-gap aria-hidden ="true" >…</span >
<a href ="/posts?page=9" >9</a >
<a href ="/posts?page=5" rst-pagination-step ="next" ><svg class ="icon" viewBox ="0 0 24 24" fill ="none" stroke ="currentColor" stroke-width ="2" stroke-linecap ="round" stroke-linejoin ="round" aria-hidden ="true" ><path d ="m6 9 6 6 6-6" /></svg ><span rst-pagination-word >下一頁</span ></a >
</nav >
喺應用程式入面,呢個會去到 /posts?page=1, /posts?page=3, /posts?page=5, /posts?page=9。喺呢度,佢嘅連結同表格都唔會去任何地方。
第一版,用預設嘅無障礙名稱
nav 嘅 aria-label 係簡單嘅「分頁」兩個字。一版有多過一個嗰陣,就講明佢分緊邊個清單。
<nav rst-pagination aria-label ="分頁" >
<span rst-pagination-disabled rst-pagination-step ="prev" ><svg class ="icon" viewBox ="0 0 24 24" fill ="none" stroke ="currentColor" stroke-width ="2" stroke-linecap ="round" stroke-linejoin ="round" aria-hidden ="true" ><path d ="m6 9 6 6 6-6" /></svg ><span rst-pagination-word >上一頁</span ></span >
<span aria-current ="page" >1</span >
<a href ="/posts?page=2" >2</a >
<a href ="/posts?page=2" rst-pagination-step ="next" ><svg class ="icon" viewBox ="0 0 24 24" fill ="none" stroke ="currentColor" stroke-width ="2" stroke-linecap ="round" stroke-linejoin ="round" aria-hidden ="true" ><path d ="m6 9 6 6 6-6" /></svg ><span rst-pagination-word >下一頁</span ></a >
</nav >
喺應用程式入面,呢個會去到 /posts?page=2。喺呢度,佢嘅連結同表格都唔會去任何地方。