Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Aug 29, 2019
1 parent e98b726 commit 0dbcc1b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,32 +121,32 @@ Slot-scope:

| Name | Type | Description |
| --- | --- | --- |
| nodes | `Object` | Value: { clickedNode: `D3.js node`, clickedText: `D3.js node` } The last node click or which text has been clicked |
| on | `Function` | Value: $on method of the tree component, exposing all events |
| actions | `Object` | Value: {collapse, collapseAll, expand, expandAll, setSelected, show, toggleExpandCollapse} where each property is a component method (see [below](#Methods) for detailed description) |

By default tree component use standardBehavior as component which provides toggle retract on node click and select the node on clickin on its text.

Example:

```HTML
<template #behavior="{nodes, actions}">
<CollapseOnClick v-bind="{nodes, actions}"/>
<template #behavior="{on, actions}">
<CollapseOnClick v-bind="{on, actions}"/>
</template>
```

With CollapseOnClick component:
```javascript
export default {
props: ['nodes', 'actions'],
props: ['on', 'actions'],

render () {
return null
},
render: () => null,

watch: {
'nodes.clickedNode': function (node) {
this.actions.toggleExpandCollapse(node)
}
created () {
const {on, actions: {toggleExpandCollapse}} = this;

on('clickedNode', ({element}) => {
toggleExpandCollapse(element);
})
}
}
```
Expand Down

0 comments on commit 0dbcc1b

Please sign in to comment.