Move component visibility validation to parent component

This commit is contained in:
Alfredo Sumaran 2017-05-31 15:33:27 -05:00
parent bfa371020e
commit 9cce9e735d
2 changed files with 5 additions and 7 deletions

View file

@ -10,16 +10,11 @@ export default {
required: false,
},
},
computed: {
hasGroups() {
return Object.keys(this.groups).length > 0;
},
},
};
</script>
<template>
<ul class="content-list group-list-tree" v-show="hasGroups">
<ul class="content-list group-list-tree">
<group-item v-for="(group, index) in groups" :key="index" :group="group" :baseGroup="baseGroup" />
</ul>
</template>

View file

@ -87,6 +87,9 @@ export default {
return fullPath;
},
hasGroups() {
return Object.keys(this.group.subGroups).length > 0;
},
},
};
</script>
@ -161,6 +164,6 @@ export default {
{{group.description}}
</div>
<group-folder v-if="group.isOpen" :groups="group.subGroups" :baseGroup="group" />
<group-folder v-if="group.isOpen && hasGroups" :groups="group.subGroups" :baseGroup="group" />
</li>
</template>