diff --git a/src/components/ListItem/ListItem.vue b/src/components/ListItem/ListItem.vue index 4dff5980a2..f5c34086b1 100644 --- a/src/components/ListItem/ListItem.vue +++ b/src/components/ListItem/ListItem.vue @@ -289,6 +289,8 @@ export default { return { hovered: false, focused: false, + hasActions: false, + hasSubtitle: false, displayActions: false, menuOpen: false, } @@ -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() { @@ -320,10 +318,6 @@ export default { } }, - // Check if the subtitle slot is populated - hasSubtitle() { - return !!this.$slots.subtitle - }, }, watch: { @@ -336,6 +330,10 @@ export default { }, }, + updated() { + this.checkSlots() + }, + methods: { // forward click event @@ -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 + }, }, }