Skip to content

Commit 291cc79

Browse files
committed
Update README.md
1 parent d7af6b5 commit 291cc79

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,17 @@ import 'vue3-tree-vue/dist/style.css'; // remember to add this in your component
2929
setup() {
3030
const onItemChecked = (checkedItems: TreeViewItem[]) => console.log(checkedItems);
3131
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.
3436

3537
// Here you can specify any kind of drop validation you will like.
3638
// this function should return true if the drop operation is valid.
3739

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+
});
4043
}
4144
const onItemExpanded = (expandedItem: TreeViewItem) => {
4245
//to use this feature properly you need to set lazyLoad property as true

0 commit comments

Comments
 (0)