-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: hywax <me@hywax.space> Co-authored-by: Benjamin Canac <canacb1@gmail.com> Co-authored-by: Sébastien Chopin <atinux@gmail.com> Co-authored-by: Sébastien Chopin <seb@nuxt.com>
- Loading branch information
1 parent
2d07cef
commit 71728d3
Showing
22 changed files
with
2,131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
docs/app/components/content/examples/tree/TreeCustomSlotExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup lang="ts"> | ||
import type { TreeItem } from '@nuxt/ui' | ||
const items: TreeItem[] = [ | ||
{ | ||
label: 'app/', | ||
slot: 'app', | ||
defaultExpanded: true, | ||
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' } | ||
] | ||
</script> | ||
|
||
<template> | ||
<UTree :items="items"> | ||
<template #app="{ item }"> | ||
<p class="italic font-bold"> | ||
{{ item.label }} | ||
</p> | ||
</template> | ||
</UTree> | ||
</template> |
34 changes: 34 additions & 0 deletions
34
docs/app/components/content/examples/tree/TreeExpandedExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
import type { TreeItem } from '@nuxt/ui' | ||
const items: TreeItem[] = [ | ||
{ | ||
label: 'app/', | ||
value: 'app', | ||
children: [{ | ||
label: 'composables/', | ||
value: 'composables', | ||
children: [ | ||
{ label: 'useAuth.ts', icon: 'i-vscode-icons-file-type-typescript' }, | ||
{ label: 'useUser.ts', icon: 'i-vscode-icons-file-type-typescript' } | ||
] | ||
}, | ||
{ | ||
label: 'components/', | ||
value: 'components', | ||
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' } | ||
] | ||
const expanded = ref(['app', 'composables']) | ||
</script> | ||
|
||
<template> | ||
<UTree v-model:expanded="expanded" :items="items" /> | ||
</template> |
33 changes: 33 additions & 0 deletions
33
docs/app/components/content/examples/tree/TreeModelValueExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script setup lang="ts"> | ||
import type { TreeItem } from '@nuxt/ui' | ||
const items: TreeItem[] = [ | ||
{ | ||
label: 'app/', | ||
defaultExpanded: true, | ||
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' } | ||
] | ||
const value = ref(items[items.length - 1]) | ||
</script> | ||
|
||
<template> | ||
<UTree v-model="value" :items="items" /> | ||
</template> |
34 changes: 34 additions & 0 deletions
34
docs/app/components/content/examples/tree/TreeOnSelectExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
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' } | ||
] | ||
</script> | ||
|
||
<template> | ||
<UTree :items="items" /> | ||
</template> |
34 changes: 34 additions & 0 deletions
34
docs/app/components/content/examples/tree/TreeOnToggleExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script setup lang="ts"> | ||
import type { TreeItem } from '@nuxt/ui' | ||
const items: TreeItem[] = [ | ||
{ | ||
label: 'app/', | ||
defaultExpanded: true, | ||
onToggle: (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' } | ||
] | ||
</script> | ||
|
||
<template> | ||
<UTree :items="items" /> | ||
</template> |
Oops, something went wrong.