Skip to content

XtfSectionTitle

组件说明

xtf-section-title 是页面分区标题组件,适用于列表、看板和表单分组,支持眉题、说明、强调条和右侧操作。与普通文本相比,它提供统一的分节布局和语义主题。


基础用法

1. 基础标题

vue
<template><xtf-section-title title="今日经营" desc="订单与成交数据实时更新。" /></template>
<script>
export default {}
</script>

2. 右侧操作

vue
<template>
  <xtf-section-title
    eyebrow="REPORT"
    title="门店日报"
    action-text="查看全部"
    show-arrow
    @action="viewAll"
  />
</template>
<script>
export default {
  methods: {
    viewAll() {
      uni.showToast({ title: '查看全部', icon: 'none' })
    }
  }
}
</script>

3. 卡片和插槽

默认插槽扩展内容,right 插槽替换右侧操作。

vue
<template>
  <xtf-section-title title="权益配置" variant="card" theme="success">
    <xtf-tag size="xs" theme="success" variant="soft" label="已启用" /><template #right
      ><xtf-button size="xs" label="新建" @click="create"
    /></template>
  </xtf-section-title>
</template>
<script>
export default {
  methods: {
    create() {
      console.log('create benefit')
    }
  }
}
</script>

全部属性

属性类型默认值作用描述适用范围
titleString''主标题所有分节
descString''标题说明需要补充上下文时
eyebrowString''标题上方辅助文案看板、报表分组
actionTextString''右侧操作文案使用默认右侧操作时
themeString'primary'强调条和图标主题primary/success/warning/danger/info
variantString'plain'plain/card/soft 视觉变体区分页面层级
sizeString'md'sm/md/lg 最小高度紧凑或重点区域
accentBooleantrue是否显示左侧强调条不需要强调时关闭
accentColorString''覆盖强调条颜色品牌色场景
showArrowBooleanfalse显示右侧箭头右侧可进入详情时
arrowIconString'chevron_right'右侧箭头图标showArrow 为真时
customClassString''根节点类名局部定制
customStyleString | Object''根节点样式局部定制

事件

事件名称触发时机回调参数参数说明
action点击右侧操作区域时(event: Event)点击事件对象;需有 actionTextshowArrowright 插槽

事件使用示例

vue
<template><xtf-section-title title="商品管理" action-text="管理" @action="manage" /></template>
<script>
export default {
  methods: {
    manage(event) {
      console.log('section action', event)
    }
  }
}
</script>

主题说明

  • 强调条使用 --xtf-color-primary--xtf-color-success--xtf-color-warning--xtf-color-danger--xtf-color-info
  • cardsoft 使用 var(--xtf-color-surface)var(--xtf-color-surface-muted)var(--xtf-color-border)
  • xtf-config-provider 覆盖这些变量,或通过 accentColor 单独调整强调色。

MIT Licensed