描述列表项组件,用于展示标签和内容的键值对形式信息,常用于详情页面的信息展示,支持不同的标签对齐方式和样式选项。
import CDescription from '@components/layout/description';
label
(String,必选):左侧标签文本labelAlign
(String,可选):标签对齐方式,默认值为 'left'left
:定宽左对齐right
:定宽右对齐none
:无固定宽度enlarged
(Boolean,可选):是否加大显示区域,默认值为 falsehasBorder
(Boolean,可选):是否显示底部边框,默认值为 false<template>
<view class="page">
<CDescription label="名称">
<text>张三</text>
</CDescription>
<CDescription label="电话">
<text>13800138000</text>
</CDescription>
<CDescription label="地址">
<text>广州市天河区某某路某某号</text>
</CDescription>
</view>
</template>
<script>
import CDescription from '@components/layout/description';
export default {
components: {
CDescription
}
}
</script>
<template>
<view class="page">
<!-- 标签右对齐 -->
<CDescription
label="订单编号"
labelAlign="right"
>
<text>OR202304250001</text>
</CDescription>
<!-- 带底部边框 -->
<CDescription
label="金额"
hasBorder
>
<text class="m-text-primary">¥198.00</text>
</CDescription>
<!-- 加大显示区域 -->
<CDescription
label="备注"
enlarged
>
<text>此订单为加急订单,请优先处理,并且联系物流安排配送</text>
</CDescription>
<!-- 无宽度限制的标签 -->
<CDescription
label="客户提供的自定义信息要求"
labelAlign="none"
>
<text>产品需要绿色包装</text>
</CDescription>
</view>
</template>
<script>
import CDescription from '@components/layout/description';
export default {
components: {
CDescription
}
}
</script>
<template>
<view class="page">
<CCard>
<CCardTitle title="订单信息" />
<CCardContent>
<CDescription label="订单编号">
<text>OR202304250001</text>
</CDescription>
<CDescription label="下单时间">
<text>2023-04-25 14:30:25</text>
</CDescription>
<CDescription label="订单状态">
<text class="m-text-warning">待处理</text>
</CDescription>
</CCardContent>
</CCard>
</view>
</template>
<script>
import CDescription from '@components/layout/description';
import { CCard, CCardTitle, CCardContent } from '@components/layout/card';
export default {
components: {
CDescription,
CCard,
CCardTitle,
CCardContent
}
}
</script>