File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,17 @@ import 'vue3-tree-vue/dist/style.css'; // remember to add this in your component
29
29
setup () {
30
30
const onItemChecked = (checkedItems : TreeViewItem []) => console .log (checkedItems );
31
31
const onItemSelected = (item : TreeViewItem ) => console .log (item );
32
- const onBeforeItemDropped = (droppedItem : TreeViewItem , dropHost : TreeViewItem | undefined ) => {
33
- // dropHost == undefined means dropping at the root of the tree.
32
+
33
+ // How to handle drag and drop logic
34
+ const onBeforeItemDropped = (droppedItem : TreeViewItem , destinationNode : TreeViewItem | undefined ) => {
35
+ // destinationNode == undefined means dropping at the root of the tree.
34
36
35
37
// Here you can specify any kind of drop validation you will like.
36
38
// this function should return true if the drop operation is valid.
37
39
38
- if (dropHost .type !== playlist ) return false
39
- return true ;
40
+ return new Promise ((resolve , _ ) => {
41
+ resolve (droppedItem !== destinationNode ) // Replace this logic with your logic.
42
+ });
40
43
}
41
44
const onItemExpanded = (expandedItem : TreeViewItem ) => {
42
45
// to use this feature properly you need to set lazyLoad property as true
You can’t perform that action at this time.
0 commit comments