File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ A Simple vue3 project for rendering items in a tree.
11
11
@onCheck =" onItemChecked"
12
12
@dropValidator =" onBeforeItemDropped"
13
13
@onSelect =" onItemSelected"
14
- @onExpanded = " lazyLoadNode "
14
+ @onExpand = " onItemExpanded "
15
15
>
16
16
<!-- Applying some simple styling to tree-items -->
17
17
<template v-slot:item-prepend-icon =" treeViewItem" >
@@ -38,7 +38,8 @@ import 'vue3-tree-vue/dist/style.css'; // remember to add this in your component
38
38
if (dropHost .type !== playlist ) return false
39
39
return true ;
40
40
}
41
- const onExpanded = (expandedItem : TreeViewItem ) => {
41
+ const onItemExpanded = (expandedItem : TreeViewItem ) => {
42
+ // to use this feature properly you need to set lazyLoad property as true
42
43
// fetch data
43
44
const lazyLoadedItems = fetchFromApi (... );
44
45
expandedItem .children .push (... lazyLoadedItems )
@@ -48,6 +49,8 @@ import 'vue3-tree-vue/dist/style.css'; // remember to add this in your component
48
49
return {
49
50
onItemChecked ,
50
51
onItemSelected ,
52
+ onBeforeItemDropped ,
53
+ onItemExpanded ,
51
54
items
52
55
}
53
56
}
@@ -84,7 +87,7 @@ export interface TreeViewItem {
84
87
checked? : boolean ;
85
88
selected? : boolean ;
86
89
expanded? : boolean ;
87
- disabled? : boolean ;// When disabled, an item can neither be selected or checked
90
+ disabled? : boolean ;// When disabled, an item can neither be selected nor checked
88
91
meta? : any ;// provides meta-data of any type per node.
89
92
}
90
93
```
You can’t perform that action at this time.
0 commit comments