Yt-UI
首页
快速开始
组件文档
首页
快速开始
组件文档
  • 表单组件

    • 输入框 Input
    • 多行输入框 Textarea
    • 开关 Switch
    • 多选框组 CheckboxGroup
    • 单选框组 RadioGroup
    • 滑块 Slider
    • 选择器 Picker
    • 日历 Calendar
    • 表单 Form
  • 展示组件

    • 头像 Avatar
    • 徽标 Badge
    • 卡片 Card
    • 标签 Tag
    • 步骤条 Steps
    • 结果页 Result
    • 空状态 Empty
    • 虚拟列表 VirtualList
  • 交互组件

    • 按钮 Button
    • 悬浮按钮 FAB
    • 图标 Icon
    • 搜索 Search
    • 分段器 Segment
    • 轮播 Swiper
    • 指示点 Dots
  • 反馈组件

    • 加载 Loading
    • 弹窗 Popup
    • 遮罩层 Overlay
    • 通告栏 NoticeBar
  • 导航组件

    • 标签栏 Tabbar
    • 顶部标签栏 TopTabbar
    • 折叠面板 Collapse
    • 课程表 Schedule
  • 布局组件

    • 分割线 Divider
    • 链接 Line
    • 可移动视图 MovableView

yt-card 卡片组件

属性

属性名类型默认值说明
themeThemeColor'classic'主题颜色
widthnumber | string'100%'卡片宽度
heightnumber | string200卡片高度
borderRadiusnumber | string10圆角大小
borderColorstring'#eee'边框颜色
shadowstring'0 1px 4px rgba(0, 0, 0, 0.25)'阴影样式
paddingnumber | string8内边距
marginnumber | string8外边距
spacingnumber | string8头部与内容间距

插槽

插槽名说明
default卡片主体内容
header卡片头部内容

事件

事件名参数说明
clicke: Event点击卡片

示例

基本卡片

<yt-card>卡片内容</yt-card>

<yt-card theme="forest">森林绿卡片</yt-card>

<yt-card theme="ocean">海洋蓝卡片</yt-card>

<yt-card theme="magic">魔法紫卡片</yt-card>

<yt-card theme="blossom">樱花粉卡片</yt-card>

<yt-card theme="sunshine">阳光橙卡片</yt-card>

<yt-card theme="classic">经典白卡片</yt-card>

<yt-card theme="forest-sky">森林星空卡片</yt-card>

<yt-card theme="ocean-sky">海洋星空卡片</yt-card>

<yt-card theme="magic-sky">魔法星空卡片</yt-card>

<yt-card theme="blossom-sky">樱花星空卡片</yt-card>

<yt-card theme="sunshine-sky">阳光星空卡片</yt-card>

带标题卡片

<yt-card theme="forest">
  <template #header>标题</template>
  卡片内容
</yt-card>

<yt-card theme="ocean">
  <template #header>海洋主题</template>
  这里是一些关于海洋的内容描述...
</yt-card>

自定义尺寸

<yt-card :width="300" :height="150" theme="magic">固定尺寸卡片</yt-card>

<yt-card width="80%" :height="200" theme="blossom">宽度百分比卡片</yt-card>

自定义样式

<yt-card
  :borderRadius="20"
  borderColor="#4CAF50"
  shadow="0 4px 12px rgba(0, 0, 0, 0.15)"
  theme="sunshine"
>
  自定义样式卡片
</yt-card>

<yt-card :padding="16" :margin="12" :spacing="12" theme="classic">
  <template #header>标题</template>
  增加间距的卡片
</yt-card>

事件处理

<yt-card @click="handleCardClick" theme="forest-sky">
  点击我
</yt-card>

复杂内容卡片

<yt-card theme="ocean-sky">
  <template #header>
    <view class="card-header">
      <text>重要通知</text>
      <yt-icon name="bell" size="16" />
    </view>
  </template>
  <view class="card-content">
    <text>这里是一段重要的通知内容...</text>
    <yt-button theme="ocean-sky" size="small">查看详情</yt-button>
  </view>
</yt-card>

完整示例

<yt-card
  theme="magic-sky"
  :width="350"
  :height="250"
  :borderRadius="15"
  borderColor="#7E57C2"
  shadow="0 6px 20px rgba(126, 87, 194, 0.2)"
  :padding="20"
  :margin="16"
  :spacing="12"
  @click="handleCardClick"
>
  <template #header>
    <view class="header-content">
      <text>魔法主题卡片</text>
      <yt-badge theme="magic-sky" :count="3" />
    </view>
  </template>
  <view class="main-content">
    <text>这是一个完整的卡片示例,包含了自定义尺寸、样式、间距和插槽内容。</text>
    <view class="actions">
      <yt-button theme="magic-sky" size="small">按钮1</yt-button>
      <yt-button theme="magic-sky" plain size="small">按钮2</yt-button>
    </view>
  </view>
</yt-card>
最近更新:: 2026/3/9 19:16
Contributors: CHEEMS, 2126340634
Prev
徽标 Badge
Next
标签 Tag