Load More
分页列表末尾的“显示更多”按钮,显示剩余数量、加载状态,出错后可重试。
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
- Meeting 1
- Meeting 2
- Meeting 3
The next page could not be loaded.
<div class="demo-stack" style="max-width: 24rem">
<ul style="margin: 0; color: var(--text-secondary)">
@for (n of shown(); track n) {
<li>Meeting {{ n }}</li>
}
</ul>
<sone-load-more [busy]="busy()" [remaining]="remaining()" (load)="load()" />
<sone-load-more error="The next page could not be loaded." />
</div>导入
import {
SoneLoadMoreComponent,
} from "@surface-one/angular/load-more";API 参考
SoneLoadMoreComponent组件
`<sone-load-more>` — the "Show more" button at the end of a paged list. It emits `(load)`; the owner fetches the next page and sets `busy` meanwhile (the button stays focusable, `aria-disabled`, and shows a spinner with `busyLabel`). `remaining` adds the count left to the label — "Show more (12)" — and hides the whole thing at 0. When the last page failed, set `error`: the message is announced (`role="alert"`) and the button becomes `retryLabel`.
| 名称 | 类型 | 默认值 |
|---|---|---|
busyThe next page is loading. | boolean | false |
remainingHow many items are left; shown in the label, and `0` hides the control. `null` = unknown. | number | null | null |
errorWhy the last load failed; shown above a retry button. | string | null | null |
label | — | $localize`Show more` |
busyLabel | — | $localize`Loading…` |
retryLabel | — | $localize`Try again` |
align | LoadMoreAlign | "center" |
| 名称 | 类型 |
|---|---|
loadLoad the next page (or retry the failed one). Never emitted while `busy`. | void |