Member-only story
Vuetify — Treeview Selections
3 min readJan 4, 2021
Vuetify is a popular UI framework for Vue apps.
In this article, we’ll look at how to work with the Vuetify framework.
Treeview Selection Type
There 2 supported types of selection.
The default type is 'leaf'
. It’ll include the leaf of the nodes when we select the parent.
The other type is 'independent'
, which lets us select all nodes individually.
For example, we can write:
<template>
<v-container>
<v-select v-model="selectionType" :items="['leaf', 'independent']" label="Selection type"></v-select>
<v-row>
<v-col>
<v-treeview
v-model="selection"
:items="items"
:selection-type="selectionType"
selectable
return-object
open-all
></v-treeview>
</v-col>
<v-divider vertical></v-divider>
</v-row>
</v-container>
</template>
<script>
export default {
name: "HelloWorld",
data: () => ({
selectionType: "leaf",
selection: [],
items: [
{
id: 1,
name: "Root",
children: [
{ id: 2, name: "Child 1" },
{ id: 3, name: "Child 2" },
{
id: 4,
name: "Child 3",
children: [
{ id: 5, name: "Grandchild 1" }…