Skip to content

Subsection 分段器

比 Tabs 更轻量的纯切换控件,无内容区。支持三种样式:default(底部高亮条)、button(填充背景)、pill(胶囊滑块)。

基础用法

vue
<template>
  <see-subsection v-model="active" :options="options" />
</template>

<script setup>
import { ref } from 'vue'
const active = ref('one')
const options = [
  { label: '选项一', value: 'one' },
  { label: '选项二', value: 'two' },
  { label: '选项三', value: 'three' }
]
</script>

Button 样式

vue
<template>
  <see-subsection v-model="active" :options="options" type="button" />
</template>

Pill 样式

vue
<template>
  <see-subsection v-model="active" :options="options" type="pill" />
</template>

SubsectionOption

属性类型说明
labelstring显示文字
valuestring | number选项值
isDisabledboolean是否禁用

Props

属性类型默认值说明
modelValuestring | number''当前选中的值
optionsSubsectionOption[][]选项列表
type'default' | 'button' | 'pill''default'样式类型
size'small' | 'default' | 'large''default'尺寸
activeColorstring''选中时背景色
isDisabledbooleanfalse是否全部禁用
isFullWidthbooleanfalse是否占满整行宽度

Events

事件名参数说明
onChangevalue, option选项切换
update:modelValuevaluev-model 更新

辽 ICP 备 2025070134 号