summaryrefslogtreecommitdiffstats
path: root/gfx/wr/debugger/src/components/TreeView.vue
blob: bde473bda2f2c146a4f3cf2d8a2f191b9bbcf771 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<template>
    <li>
        <div v-on:click="toggle">
            <span v-if="isFolder">[{{open ? '-' : '+'}}]</span>
            {{model.description}}
        </div>
        <ul style="padding-left: 1em; line-height: 1.5em;" v-show="open" v-if="isFolder">
            <treeview v-for="model in model.children" :model="model"></treeview>
        </ul>
    </li>
</template>

<script>
export default {
    name: 'treeview',
    props: [
        'model',
    ],
    data: function () {
        return {
            open: false
        }
    },
    computed: {
        isFolder: function () {
            return this.model.children && this.model.children.length
        }
    },
    methods: {
        toggle: function () {
            if (this.isFolder) {
                this.open = !this.open
            }
        },
    },
}
</script>

<style>
</style>