Skip to content

Commit 2a0db28

Browse files
committed
2 parents 552da60 + 3a4810d commit 2a0db28

File tree

2 files changed

+44
-19
lines changed

2 files changed

+44
-19
lines changed

.github/workflows/main

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '14'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Run Jest tests
25+
run: npm test

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,32 @@ 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-
32+
3333
// How to handle drag and drop logic
3434
const onBeforeItemDropped = (droppedItem: TreeViewItem, destinationNode: TreeViewItem | undefined) => {
35-
// destinationNode == undefined means dropping at the root of the tree.
36-
37-
// Here you can specify any kind of drop validation you will like.
38-
// this function should return true if the drop operation is valid.
39-
40-
return new Promise((resolve, _) => {
41-
resolve(droppedItem !== destinationNode) // Replace this logic with your logic.
42-
});
35+
// destinationNode == undefined means dropping at the root of the tree.
36+
37+
// Here you can specify any kind of drop validation you will like.
38+
// this function should return true if the drop operation is valid.
39+
40+
return new Promise((resolve, _) => {
41+
resolve(droppedItem !== destinationNode) // Replace this logic with your logic.
42+
});
4343
}
4444
const onItemExpanded = (expandedItem: TreeViewItem) => {
45-
//to use this feature properly you need to set lazyLoad property as true
46-
//fetch data
47-
const lazyLoadedItems = fetchFromApi(...);
48-
expandedItem.children.push(...lazyLoadedItems)
45+
//to use this feature properly you need to set lazyLoad property as true
46+
//fetch data
47+
const lazyLoadedItems = fetchFromApi(...);
48+
expandedItem.children.push(...lazyLoadedItems)
4949
}
5050
const items = ref<TreeViewItem[]>([]); // define your tree items here.
5151

5252
return {
53-
onItemChecked,
54-
onItemSelected,
55-
onBeforeItemDropped,
56-
onItemExpanded,
57-
items
53+
onItemChecked,
54+
onItemSelected,
55+
onBeforeItemDropped,
56+
onItemExpanded,
57+
items
5858
}
5959
}
6060
```
@@ -125,4 +125,4 @@ export interface TreeViewItem {
125125

126126
| Name | Description |
127127
| -------------|-------------
128-
| on-item-hover | Use in `child-append` and `item-append` slots to only show when the cursor is hovering on the node
128+
| on-item-hover | Use in `child-append` and `item-append` slots to only show when the cursor is hovering on the node

0 commit comments

Comments
 (0)