Skip to content

TTreeMenu / 树型菜单

TreeMenu renders a hierarchical sidebar navigation with expand/collapse, accordion mode, and select events. Used in the demo app sidebar. / 树型菜单渲染层级侧边栏导航,支持展开/折叠、手风琴模式和选中事件。

Props / 属性

PropType / 类型Default / 默认值Description / 说明
itemsTreeMenuItem[][]Menu data
accordionbooleantrueAccordion mode
defaultExpandAllbooleanfalseExpand all by default
indentnumber16Indent per level

Events / 事件

EventPayloadDescription
@selectitem: TreeMenuItemItem selected

Basic Usage / 基础用法

vue
<script setup lang="ts">
import { TTreeMenu } from '@gulcc/tabler-vue'

const items = [
  { label: 'Home', icon: IconHome, _name: 'home' },
  { label: 'Section', children: [
    { label: 'Item 1', _name: 'item1' },
    { label: 'Item 2', _name: 'item2' },
  ]},
]

function onSelect(item: any) {
  // handle selection
}
</script>

<template>
  <TTreeMenu :items="items" @select="onSelect" />
</template>