DataView
List / grid with pagination
A collection shown as cards or rows you design yourself — a catalogue, a gallery of episodes — with a list/grid switch and paging. For tabular data people sort and select, use DataTable.
Basic
第1話
2019.04.04
第2話
2019.04.05
第3話
2019.04.06
第4話
2019.04.07
- The default slot renders each item with
{ item, index, layout }, so one template can adapt to list and grid. columnsis the minimum card width in grid layout;pageSizepages client-side (0 shows everything). Whenitemsshrinks, the page follows back to the last one.#emptyreplaces "No items".
Usage
ts
import { BlessDataView } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
items* | T[] | — | |
rowKey | ((item: T, index: number) => string | number) | — | |
pageSize | number | 0 | |
columns | string | "220px" | min card width in grid layout |
label | string | "Items" | |
switchable | boolean | true | hide the list/grid switch |
layout | "grid" | "list" | "list" |
Events
| Name | Payload | Description |
|---|---|---|
update:layout | [value: "grid" | "list"] |
Slots
| Name | Scope | Description |
|---|---|---|
header | { layout: "grid" | "list"; } | |
default | { item: T; index: number; layout: "grid" | "list"; } | |
empty | — |