Collapse all submenus if the main menu gets collapsed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
|
||||
import { ref, computed, useTemplateRef } from 'vue';
|
||||
import { ref, computed, useTemplateRef, watch } from 'vue';
|
||||
import { Menu } from '@cloudron/pankow';
|
||||
import SideBarItem from './SideBarItem.vue';
|
||||
|
||||
@@ -38,6 +38,12 @@ const props = defineProps({
|
||||
}
|
||||
});
|
||||
|
||||
const isExpanded = ref(false);
|
||||
|
||||
watch(() => props.collapsed, () => {
|
||||
isExpanded.value = false;
|
||||
});
|
||||
|
||||
const isActive = computed(() => {
|
||||
const active = props.active;
|
||||
return typeof active === 'function' ? active() : active ?? true;
|
||||
@@ -48,7 +54,6 @@ const isVisible = computed(() => {
|
||||
return typeof visible === 'function' ? visible() : visible ?? true;
|
||||
});
|
||||
|
||||
const isExpanded = ref(false);
|
||||
|
||||
function close() {
|
||||
emit('close');
|
||||
|
||||
Reference in New Issue
Block a user