Skip to content

xtf-cell-group

组件说明

xtf-cell-group 是单元格组容器组件,用于将多个 xtf-cell 分组展示。支持标题/描述/备注、多种视觉变体(纯色、表面、柔和、卡片、玻璃)和统一圆角间距配置,是设置页和表单列表的基础布局组件。


基础用法

1. 最简示例

通过 title 设置分组标题,包裹 xtf-cell 即可:

vue
<template>
  <xtf-cell-group title="基本信息">
    <xtf-cell title="姓名" value="张三" />
    <xtf-cell title="手机号" value="138****8888" />
    <xtf-cell title="邮箱" value="zhangsan@example.com" />
  </xtf-cell-group>
</template>

2. 标题与备注

通过 eyebrow 设置眉标,desc 设置描述,note 设置底部备注:

vue
<template>
  <xtf-cell-group
    eyebrow="账号安全"
    title="登录设置"
    desc="管理你的登录方式"
    note="修改后需重新登录"
  >
    <xtf-cell title="手机号" value="138****8888" arrow />
    <xtf-cell title="邮箱" value="已绑定" arrow />
    <xtf-cell title="微信" value="未绑定" arrow />
  </xtf-cell-group>
</template>

3. 视觉变体

通过 variant 切换分组视觉风格:

vue
<template>
  <view style="display: flex; flex-direction: column; gap: 24rpx">
    <xtf-cell-group title="表面" variant="surface">
      <xtf-cell title="选项一" value="值" />
      <xtf-cell title="选项二" value="值" />
    </xtf-cell-group>
    <xtf-cell-group title="柔和" variant="soft">
      <xtf-cell title="选项一" value="值" />
      <xtf-cell title="选项二" value="值" />
    </xtf-cell-group>
    <xtf-cell-group title="卡片" variant="card">
      <xtf-cell title="选项一" value="值" />
      <xtf-cell title="选项二" value="值" />
    </xtf-cell-group>
    <xtf-cell-group title="玻璃" variant="glass">
      <xtf-cell title="选项一" value="值" />
      <xtf-cell title="选项二" value="值" />
    </xtf-cell-group>
  </view>
</template>

4. 间距与圆角

通过 gap 调整子项间距,通过 radius 控制圆角,通过 inset 设置子单元格分割线缩进:

vue
<template>
  <xtf-cell-group title="设置" :gap="8" :radius="40" :inset="24">
    <xtf-cell title="通知" divider arrow />
    <xtf-cell title="隐私" divider arrow />
    <xtf-cell title="通用" arrow />
  </xtf-cell-group>
</template>

全部属性

属性类型默认值作用描述适用范围
titleString''分组标题设置标题
eyebrowString''标题上方眉标文字分组标签
descString''标题下方描述文字补充说明
noteString''底部备注文字底部提示
variantString'surface'视觉变体:'plain' / 'surface' / 'soft' / 'card' / 'glass'切换视觉风格
radiusString | Number32内容区圆角(rpx)控制圆角
paddingString | Number0容器内边距(rpx)控制内边距
gapString | Number18头部/内容/底部之间的间距(rpx)调整间距
insetString | Number0子单元格分割线缩进(rpx)分割线缩进
customClassString''自定义类名样式覆盖
customStyleString | Object''自定义样式动态样式覆盖
bodyClassString''内容区自定义类名内容区样式定制

事件

无自定义事件。


插槽

插槽名说明
header替换标题、眉标和描述组成的头部。
默认插槽放置 xtf-cell 等单元格内容。
footer替换底部备注。

主题说明

  • plain 变体内容区背景透明
  • surface 变体内容区背景使用 var(--xtf-color-surface)
  • soft 变体内容区背景使用 var(--xtf-color-surface-muted)
  • card 变体内容区背景使用 var(--xtf-card-bg),边框使用 var(--xtf-card-border),阴影使用 var(--xtf-shadow-card)
  • glass 变体内容区背景使用 var(--xtf-popup-bg),边框使用 var(--xtf-card-border),阴影使用 var(--xtf-shadow-glass)

如需全局调整主题,请在 xtf-config-provider 或主题配置中覆盖上述 CSS 变量。

MIT Licensed