Descriptions 描述列表 (版本: 1.5.0+)
成组展示多个只读字段。
何时使用
常见于详情页的信息展示。
代码演示
基本
简单的展示。
<template>
<a-descriptions title="User Info">
<a-descriptions-item label="UserName">
Zhou Maomao
</a-descriptions-item>
<a-descriptions-item label="Telephone">
1810000000
</a-descriptions-item>
<a-descriptions-item label="Live">
Hangzhou, Zhejiang
</a-descriptions-item>
<a-descriptions-item label="Remark">
empty
</a-descriptions-item>
<a-descriptions-item label="Address">
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</a-descriptions-item>
</a-descriptions>
</template>
带边框的
<template>
<a-descriptions title="User Info" bordered>
<a-descriptions-item label="Product">
Cloud Database
</a-descriptions-item>
<a-descriptions-item label="Billing Mode">
Prepaid
</a-descriptions-item>
<a-descriptions-item label="Automatic Renewal">
YES
</a-descriptions-item>
<a-descriptions-item label="Order time">
2018-04-24 18:00:00
</a-descriptions-item>
<a-descriptions-item label="Usage Time" :span="2">
2019-04-24 18:00:00
</a-descriptions-item>
<a-descriptions-item label="Status" :span="3">
<a-badge status="processing" text="Running" />
</a-descriptions-item>
<a-descriptions-item label="Negotiated Amount">
$80.00
</a-descriptions-item>
<a-descriptions-item label="Discount">
$20.00
</a-descriptions-item>
<a-descriptions-item label="Official Receipts">
$60.00
</a-descriptions-item>
<a-descriptions-item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</a-descriptions-item>
</a-descriptions>
</template>
自定义尺寸
自定义尺寸,适应在各种容器中展示。
<template>
<div>
<a-radio-group v-model="size" @change="onChange">
<a-radio value="default">
default
</a-radio>
<a-radio value="middle">
middle
</a-radio>
<a-radio value="small">
small
</a-radio>
</a-radio-group>
<br />
<br />
<a-descriptions bordered title="Custom Size" :size="size">
<a-descriptions-item label="Product">
Cloud Database
</a-descriptions-item>
<a-descriptions-item label="Billing">
Prepaid
</a-descriptions-item>
<a-descriptions-item label="Time">
18:00:00
</a-descriptions-item>
<a-descriptions-item label="Amount">
$80.00
</a-descriptions-item>
<a-descriptions-item label="Discount">
$20.00
</a-descriptions-item>
<a-descriptions-item label="Official">
$60.00
</a-descriptions-item>
<a-descriptions-item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</a-descriptions-item>
</a-descriptions>
<br />
<br />
<a-descriptions title="Custom Size" :size="size">
<a-descriptions-item label="Product">
Cloud Database
</a-descriptions-item>
<a-descriptions-item label="Billing">
Prepaid
</a-descriptions-item>
<a-descriptions-item label="Time">
18:00:00
</a-descriptions-item>
<a-descriptions-item label="Amount">
$80.00
</a-descriptions-item>
<a-descriptions-item label="Discount">
$20.00
</a-descriptions-item>
<a-descriptions-item label="Official">
$60.00
</a-descriptions-item>
</a-descriptions>
</div>
</template>
<script>
export default {
data() {
return {
size: 'default',
};
},
methods: {
onChange(e) {
console.log('size checked', e.target.value);
this.size = e.target.value;
},
},
};
</script>
响应式
通过响应式的配置可以实现在小屏幕设备上的完美呈现。
<template>
<div>
<a-descriptions
title="Responsive Descriptions"
bordered
:column="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }"
>
<a-descriptions-item label="Product">
Cloud Database
</a-descriptions-item>
<a-descriptions-item label="Billing">
Prepaid
</a-descriptions-item>
<a-descriptions-item label="Time">
18:00:00
</a-descriptions-item>
<a-descriptions-item label="Amount">
$80.00
</a-descriptions-item>
<a-descriptions-item label="Discount">
$20.00
</a-descriptions-item>
<a-descriptions-item label="Official">
$60.00
</a-descriptions-item>
<a-descriptions-item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1
</a-descriptions-item>
</a-descriptions>
</div>
</template>
垂直
垂直的列表。
<template>
<a-descriptions title="User Info" layout="vertical">
<a-descriptions-item label="UserName">
Zhou Maomao
</a-descriptions-item>
<a-descriptions-item label="Telephone">
1810000000
</a-descriptions-item>
<a-descriptions-item label="Live">
Hangzhou, Zhejiang
</a-descriptions-item>
<a-descriptions-item label="Address" span="2">
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
</a-descriptions-item>
<a-descriptions-item label="Remark">
empty
</a-descriptions-item>
</a-descriptions>
</template>
垂直带边框的
垂直带边框和背景颜色的列表。
<template>
<a-descriptions title="User Info" layout="vertical" bordered>
<a-descriptions-item label="Product">
Cloud Database
</a-descriptions-item>
<a-descriptions-item label="Billing Mode">
Prepaid
</a-descriptions-item>
<a-descriptions-item label="Automatic Renewal">
YES
</a-descriptions-item>
<a-descriptions-item label="Order time">
2018-04-24 18:00:00
</a-descriptions-item>
<a-descriptions-item label="Usage Time" :span="2">
2019-04-24 18:00:00
</a-descriptions-item>
<a-descriptions-item label="Status" :span="3">
<a-badge status="processing" text="Running" />
</a-descriptions-item>
<a-descriptions-item label="Negotiated Amount">
$80.00
</a-descriptions-item>
<a-descriptions-item label="Discount">
$20.00
</a-descriptions-item>
<a-descriptions-item label="Official Receipts">
$60.00
</a-descriptions-item>
<a-descriptions-item label="Config Info">
Data disk type: MongoDB
<br />
Database version: 3.4
<br />
Package: dds.mongo.mid
<br />
Storage space: 10 GB
<br />
Replication factor: 3
<br />
Region: East China 1<br />
</a-descriptions-item>
</a-descriptions>
</template>
API
Descriptions props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
title | 描述列表的标题,显示在最顶部 | string | VNode | v-slot:title | - |
bordered | 是否展示边框 | boolean | false |
column | 一行的 DescriptionItems 数量,可以写成像素值或支持响应式的对象写法 { xs: 8, sm: 16, md: 24} | number | 3 |
size | 设置列表的大小。可以设置为 middle 、small , 或不填(只有设置 bordered={true} 生效) | default | middle | small | default |
layout | 描述布局 | horizontal | vertical | horizontal |
colon | 配置 Descriptions.Item 的 colon 的默认值 | boolean | true |
Item props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
label | 内容的描述 | string | VNode | v-slot:label | - |
span | 包含列的数量 | number | 1 |
span 是 Descriptions.Item 的数量。 span={2} 会占用两个 DescriptionsItem 的宽度。