Skip to content
On this page

title组件

Hidden Title

基础用法:<s-title title="你好"></s-title>

属性事件插槽简介

基础用法

成华主题

chenghua主题示例

石景山主题

shijingshan主题示例

通常用法

compTitle 也可以作为独立组件使用,完整文档见 CompTitle 组件标题前缀

标题内容

标题内容按 title 命名插槽、默认插槽、title 属性的顺序取值,三种方式共享相同的标题样式:

vue
<s-title title="属性标题" />
<s-title>默认插槽标题</s-title>
<s-title>
  <template #title>命名插槽标题</template>
</s-title>
<s-title title="属性标题" />
<s-title>默认插槽标题</s-title>
<s-title>
  <template #title>命名插槽标题</template>
</s-title>

需要在标题后追加状态、标签或操作内容时,使用 append 插槽:

vue
<s-title title="服务状态">
  <template #append><s-tag type="success">运行中</s-tag></template>
</s-title>
<s-title title="服务状态">
  <template #append><s-tag type="success">运行中</s-tag></template>
</s-title>

属性

属性名说明类型默认值
title主标题文案string''
size尺寸,支持 small / default / largestringdefault
subTitle副标题文案string''
subAttrs副标题额外属性object{}
inner是否使用内部缩进booleanfalse
margin外边距,支持 CSS margin 简写string / number''
gap标题内部间距,控制图标、标题、副标题、右侧区域间距string / number''
t上边距,兼容快捷写法,优先级高于 marginstring / number''
b下边距,兼容快捷写法,优先级高于 marginstring / number''
l左边距,兼容快捷写法,优先级高于 marginstring / number''
tb同时设置上下边距,兼容快捷写法,优先级高于 marginstring / number-
height组件高度string / number''
type标题样式类型,支持 '' / icon / simple / formstring''
theme主题样式,支持 default / chenghua / shijingshanstringdefault
tag标题标签,支持 div / h1 / h2 / h3 / h4 / h5 / h6stringdiv
level非原生标题标签的无障碍标题层级,支持 16number3

插槽

插槽名说明
title自定义标题内容,优先级高于默认插槽和 title 属性
default自定义标题内容,未提供 title 命名插槽时生效
icon自定义左侧图标
append在标题、副标题后追加状态或其他内容
extra右侧操作区

思云博智私有前端组件库