mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
84f87a5953
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
44 lines
1.1 KiB
Vue
44 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import type { TreeItemSelectEvent } from 'reka-ui'
|
|
import type { TreeItem } from '@nuxt/ui'
|
|
|
|
const items: TreeItem[] = [
|
|
{
|
|
label: 'app/',
|
|
defaultExpanded: true,
|
|
onSelect: (e: Event) => {
|
|
e.preventDefault()
|
|
},
|
|
children: [
|
|
{
|
|
label: 'composables/',
|
|
children: [
|
|
{ label: 'useAuth.ts', icon: 'i-vscode-icons-file-type-typescript' },
|
|
{ label: 'useUser.ts', icon: 'i-vscode-icons-file-type-typescript' }
|
|
]
|
|
},
|
|
{
|
|
label: 'components/',
|
|
defaultExpanded: true,
|
|
children: [
|
|
{ label: 'Card.vue', icon: 'i-vscode-icons-file-type-vue' },
|
|
{ label: 'Button.vue', icon: 'i-vscode-icons-file-type-vue' }
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{ label: 'app.vue', icon: 'i-vscode-icons-file-type-vue' },
|
|
{ label: 'nuxt.config.ts', icon: 'i-vscode-icons-file-type-nuxt' }
|
|
]
|
|
|
|
function onSelect(e: TreeItemSelectEvent<TreeItem>) {
|
|
if (e.detail.originalEvent.type === 'click') {
|
|
e.preventDefault()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<UTree :items="items" @select="onSelect" />
|
|
</template>
|