给表单、表格的一块内容加标题:左侧一条强调色短竖线,宽度 4px、高度 16px,颜色跟随 --el-color-primary。
可以直接传 title,也可以把任意内容放进默认插槽。
使用 title 属性设置标题。
不传 title 时,默认插槽的内容会显示在色条右侧。
<script setup lang="ts">
import { KSectionTitle } from '@wujies/components';
</script>
<template>
<div>
<KSectionTitle title="基本信息" />
<p style="margin: 0 0 20px; color: var(--el-text-color-regular)">使用 title 属性设置标题。</p>
<KSectionTitle>
自定义内容 <span style="font-weight: 400; color: var(--el-text-color-secondary)">(默认插槽)</span>
</KSectionTitle>
<p style="margin: 0; color: var(--el-text-color-regular)">不传 title 时,默认插槽的内容会显示在色条右侧。</p>
</div>
</template>
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| title | 标题文本;有默认插槽时插槽优先 | string | — |
| 插槽名 | 说明 |
|---|---|
| default | 自定义标题内容 |