页签 Tabs

line 状态, renderSlot

segment 状态

border 状态

前置标签

API

Attributes

名称类型可选值默认值说明
model-value / v-modelString--选中的对象 ID
data[ ]-[ ]选项集合 详细解释如下
typestringline - segment - borderline类型
backgroundColorstringCSS ColorValue''背景颜色
sizestringlarge - medium - smallmediumtabs 大小,line 模式下只有large - medium可选
scrollPositionstringstart - endstartTab 较多的时候,选中滑块滚动最终停留的位置
item-widthstring--每一个 tabs-item 的 width 设置
renderSlotobject {component:component,html:string,style:object}-item 中的插槽渲染
renderPreSlotobject {component:component,html:string,style:object,iconName: string,iconSize: number,iconColor: string}-item 中的前置插槽渲染

Events

名称类型可选值默认值说明
changefunction(item: object, event: Event)--点击回调事件

Tabs 方法

名称类型说明
setBarStyle-计算 tab 宽度
// 单个对象
export type Item = {
    id: string;
    name: string;
    class: string; // 单个的tab的class
    disabled: boolean; // 是否禁用
    slotName: string; // 插槽渲染
    renderSlot?: {  // 渲染插槽
        component: h(MLogo, {count: 10}), // 组件   注意 component和html同时存在时,优先使用component
        html: `<div>(<span style="color: red">23</span>/100)</div>`, // html
        style: {    // renderSlot div容器样式
            color: 'red'
        }
    };
}

最近更新于: