Skip to content

Menu 导航菜单

为网站提供导航功能的菜单,支持水平/垂直模式、子菜单展开、折叠等特性。

基础用法

通过 mode 属性设置水平或垂直菜单,default-active 设置当前激活项。

垂直菜单 + 子菜单

垂直模式下通过 ZcSubmenu 创建子菜单。

折叠菜单

通过 collapse 属性将垂直菜单折叠为图标模式。

Props

参数说明类型默认值
mode菜单模式'horizontal' | 'vertical''vertical'
defaultActive当前激活项索引string''
collapse是否折叠(垂直模式)booleanfalse
backgroundColor菜单背景色string''
textColor菜单文字颜色string''
activeTextColor激活项文字颜色string''
uniqueOpened是否只保持一个子菜单展开booleanfalse
collapseTransition折叠动画booleantrue
router是否启用路由模式booleanfalse

Events

事件名说明回调参数
select菜单项选中(index: string, indexPath: string[])
open子菜单展开(index: string, indexPath: string[])
close子菜单收起(index: string, indexPath: string[])
参数说明类型默认值
index唯一标识string''
route路由路径string''
disabled是否禁用booleanfalse
参数说明类型默认值
index唯一标识string''
popperClass弹出层自定义类名string''
showTimeout显示延迟(ms,水平模式)number300
hideTimeout隐藏延迟(ms,水平模式)number300
disabled是否禁用booleanfalse
插槽名说明
title子菜单标题
default子菜单内容

基于 MIT 许可发布