Skip to content

Commit

Permalink
Check slots on updated hook
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
  • Loading branch information
marcoambrosini committed Jun 7, 2021
1 parent aea9b8d commit 56e11b2
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/ListItem/ListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ export default {
return {
hovered: false,
focused: false,
hasActions: false,
hasSubtitle: false,
displayActions: false,
menuOpen: false,
}
Expand All @@ -300,10 +302,6 @@ export default {
return this.details !== ''
},
hasActions() {
return (!!this.$slots.actions)
},
// This is used to decide which outer element type to use
// li or router-link
navElement() {
Expand All @@ -320,10 +318,6 @@ export default {
}
},
// Check if the subtitle slot is populated
hasSubtitle() {
return !!this.$slots.subtitle
},
},
watch: {
Expand All @@ -336,6 +330,10 @@ export default {
},
},
updated() {
this.checkSlots()
},
methods: {
// forward click event
Expand Down Expand Up @@ -400,6 +398,12 @@ export default {
handleActionsUpdateOpen(e) {
this.menuOpen = e
},
// Check if subtitle and actions slots is populated
checkSlots() {
this.hasActions = !!this.$slots.actions
this.hasSubtitle = !!this.$slots.subtitle
},
},
}
</script>
Expand Down

0 comments on commit 56e11b2

Please sign in to comment.