feat: refs #8197 default leftMenu
gitea/salix-front/pipeline/pr-master There was a failure building this commit Details
gitea/salix-front/pipeline/pr-beta There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2024-12-16 13:33:59 +01:00
parent 95420e96d1
commit dc665d43fe
2 changed files with 22 additions and 9 deletions

View File

@ -1,12 +1,9 @@
<script setup> <script setup>
import LeftMenu from '../LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
import RightMenu from './RightMenu.vue'; import RightMenu from './RightMenu.vue';
import VnSearchbar from 'components/ui/VnSearchbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnTableFilter from '../VnTable/VnTableFilter.vue'; import VnTableFilter from '../VnTable/VnTableFilter.vue';
import { onBeforeMount } from 'vue'; import { onBeforeMount } from 'vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
const stateStore = useStateStore();
const $props = defineProps({ const $props = defineProps({
section: { section: {
@ -58,10 +55,6 @@ onBeforeMount(() => {
/> />
</slot> </slot>
<Teleport to="#left-panel" v-if="stateStore.isHeaderMounted()">
<LeftMenu v-if="section == $route.name" />
</Teleport>
<RightMenu> <RightMenu>
<template #right-panel v-if="$slots['rightMenu'] || rightFilter"> <template #right-panel v-if="$slots['rightMenu'] || rightFilter">
<slot name="rightMenu"> <slot name="rightMenu">

View File

@ -1,7 +1,8 @@
<script setup> <script setup>
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { onMounted } from 'vue'; import { onMounted, ref } from 'vue';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import LeftMenu from '../LeftMenu.vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const $props = defineProps({ const $props = defineProps({
@ -13,12 +14,31 @@ const $props = defineProps({
onMounted( onMounted(
() => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false) () => (stateStore.leftDrawer = useQuasar().screen.gt.xs ? $props.leftDrawer : false)
); );
const targetId = 'left-panel';
const teleportRef = ref({});
const hasContent = ref();
let observer;
onMounted(() => {
if (teleportRef.value) {
const checkContent = () => {
hasContent.value = teleportRef.value.innerHTML.trim() !== '';
};
observer = new MutationObserver(checkContent);
observer.observe(teleportRef.value, { childList: true, subtree: true });
checkContent();
}
});
</script> </script>
<template> <template>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256"> <QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<div id="left-panel"></div> <div :id="targetId" ref="teleportRef"></div>
<LeftMenu v-if="!hasContent" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>