Card 组件广泛应用于各种需要展示内容的场景,例如:
Card 组件提供了一系列基本功能,包括:
import { Card, Col, Row, Button, Badge } from "vant";
const data = ref({
shoulderPress: {
title: "Shoulder Press",
duration: "10 mins",
},
bicepCurls: {
title: "Bicep Curls",
duration: "10 mins",
},
// ...
});
<template #header>
<div class="flex items-center justify-between">
<span>{{ data.shoulderPress.title }}</span>
<Button type="primary" size="small">Start</Button>
</div>
</template>
<template #body>
<div class="flex items-center justify-between">
<div class="flex items-center">
<img src="..." alt="avatar" />
<div class="ml-4">
<h3 class="text-lg font-semibold">{{ data.shoulderPress.title }}</h3>
<p class="text-sm text-gray-500">{{ data.shoulderPress.duration }}</p>
</div>
</div>
<div>
<Button type="primary" size="small">15:00</Button>
</div>
</div>
</template>
<Row>
<Col span="6">
<Card>
<!-- ... -->
</Card>
</Col>
<!-- ... -->
</Row>
开发这段代码的过程让我深入了解了 Card 组件的特性和使用方法。它是一个功能强大且易于使用的组件,可以轻松创建响应式、可定制的卡片。
未来,我计划扩展该卡片功能,使其支持:
通过这些增强,Card 组件将成为构建更复杂和交互式界面的宝贵工具。