List列表·续1
<template> <a-list :grid="{ gutter: 16, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: 3 }" :data-source="data"> <template #renderItem="{ item }"> <a-list-item> <a-card :title="item.title">Card content</a-card> </a-list-item> </template> </a-list></template><script lang="ts">import { defineComponent } from 'vue';interface DataItem { title: string;}const data: DataItem[] = [ { title: 'Title 1', }, { title: 'Title 2', }, { title: 'Title 3', }, { title: 'Title 4', }, { title: 'Title 5', }, { title: 'Title 6', },];export default defineComponent({ setup() { return { data, }; },});</script>
API
List
| bordered |
是否展示边框 |
boolean |
false |
|
|
|
|
|
|
| footer | 列表底部 | string|slot | - | |
|---|---|---|---|---|
| header | 列表头部 | string|slot | - | |
|---|---|---|---|---|
| itemLayout |
设置 List.Item 布局, 设置成 vertical 则竖直样式显示, 默认横排 |
string |
- |
|
|
|
|
|
|
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean|object | false | |
|---|---|---|---|---|
| loadMore | 加载更多 | string|slot | - | |
|---|---|---|---|---|
| locale |
默认文案设置,目前包括空数据文案 |
object |
emptyText: ‘暂无数据’ |
|
|
|
|
|
|
| pagination | 对应的 pagination 配置, 设置 false 不显示 | boolean|object | false | |
|---|---|---|---|---|
| size | list 的尺寸 | default | middle | small | default | |
|---|---|---|---|---|
| split |
是否展示分割线 |
boolean |
true |
|
|
|
|
|
|
| dataSource |
列表数据源 |
any[] |
- |
1.5.0 |
|
|
|
|
|
| renderItem |
自定义Item函数,也可使用 #renderItem=”{item, index}” |
({item, index}) => vNode |
|
- |
|
|
|
|
|
| rowKey | 各项 key 的取值,可以是字符串或一个函数 | item => string|number | | |
|---|---|---|---|---|
分页的配置项。
| position | 指定分页显示的位置 | ‘top’ | ‘bottom’ | ‘both’ | ‘bottom’ |
|---|---|---|---|
更多配置项,请查看 Pagination。
List grid props
| column |
列数 |
number oneOf [ 1, 2, 3, 4, 6, 8, 12, 24] |
- |
|
|
|
|
| xl |
≥1200px 展示的列数 |
number |
- |
|
|
|
|
| xxl |
≥1600px 展示的列数 |
number |
- |
|
|
|
|
List.Item
| actions |
列表操作组,根据 itemLayout 的不同, 位置在卡片底部或者最右侧 |
Array<vNode>/ |
slot |
|
|
|
|
| extra | 额外内容, 通常用在 itemLayout 为 vertical 的情况下, 展示右侧内容; horizontal 展示在列表元素最右侧 | string|slot | - |
|---|---|---|---|
| description | 列表元素的描述内容 | string|slot | - |
|---|---|---|---|
| title | 列表元素的标题 | string|slot | - |
|---|---|---|---|