holiber / sl-vue-tree

Customizable draggable tree component for Vue.js
MIT License
344 stars 79 forks source link

Expand tree by clicking title #46

Closed bingimar closed 5 years ago

bingimar commented 5 years ago

is there a way of expanding the node by clicking the title?

holiber commented 5 years ago

You can handle your own events in the title slot:

<sl-vue-tree v-model="nodes">
    <template slot="title" slot-scope="{ node }">

      <div class="my-custom-title" @click="expandNode(node)">
        {{ node.title }}
      </div>

    </template>
</sl-vue-tree>
expandNode(node) {
  this.refs.slVueTree.updateNode(node.path, { isExpanded: true });
}