vn qtoolbar
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-01-03 09:59:27 +01:00
parent f2c29baeb6
commit 3acc4b0d58
4 changed files with 30 additions and 6 deletions

View File

@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import ClaimDescriptor from './ClaimDescriptor.vue'; import ClaimDescriptor from './ClaimDescriptor.vue';
import { onMounted } from 'vue'; import { onMounted, onUnmounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -22,6 +22,18 @@ const $props = defineProps({
const entityId = computed(() => { const entityId = computed(() => {
return $props.id || route.params.id; return $props.id || route.params.id;
}); });
onMounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
onUnmounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">

View File

@ -18,6 +18,7 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const stateStore = useStateStore(); const stateStore = useStateStore();
const subToolbarLoaded = computed(() => stateStore.isSubToolbarShown());
const arrayData = useArrayData('ClaimLines'); const arrayData = useArrayData('ClaimLines');
const store = arrayData.store; const store = arrayData.store;
@ -157,7 +158,8 @@ function isSubToolbarShown() {
} }
</script> </script>
<template> <template>
<Teleport to="#st-data" v-if="isSubToolbarShown()"> {{ subToolbarLoaded }}
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<QToolbar> <QToolbar>
<div class="row q-gutter-md"> <div class="row q-gutter-md">
<div> <div>

View File

@ -5,10 +5,17 @@ import { useRoute } from 'vue-router';
import CustomerDescriptor from './CustomerDescriptor.vue'; import CustomerDescriptor from './CustomerDescriptor.vue';
import LeftMenu from 'components/LeftMenu.vue'; import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import { onMounted } from 'vue';
const stateStore = useStateStore(); const stateStore = useStateStore();
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
onMounted(() => {
console.log('MOUNTED', stateStore.isSubToolbarShown());
stateStore.toggleSubToolbar();
console.log('MOUNTED', stateStore.isSubToolbarShown());
});
</script> </script>
<template> <template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()"> <Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">

View File

@ -5,6 +5,7 @@ export const useStateStore = defineStore('stateStore', () => {
const isMounted = ref(false); const isMounted = ref(false);
const leftDrawer = ref(false); const leftDrawer = ref(false);
const rightDrawer = ref(false); const rightDrawer = ref(false);
const subToolbar = ref(false);
function toggleLeftDrawer() { function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value; leftDrawer.value = !leftDrawer.value;
@ -14,6 +15,10 @@ export const useStateStore = defineStore('stateStore', () => {
rightDrawer.value = !rightDrawer.value; rightDrawer.value = !rightDrawer.value;
} }
function toggleSubToolbar() {
subToolbar.value = !subToolbar.value;
}
function setMounted() { function setMounted() {
isMounted.value = true; isMounted.value = true;
} }
@ -31,10 +36,7 @@ export const useStateStore = defineStore('stateStore', () => {
} }
function isSubToolbarShown() { function isSubToolbarShown() {
return ( return subToolbar.value;
!!document.querySelector('#st-data') &&
!!document.querySelector('#st-actions')
);
} }
return { return {
@ -47,5 +49,6 @@ export const useStateStore = defineStore('stateStore', () => {
isLeftDrawerShown, isLeftDrawerShown,
isRightDrawerShown, isRightDrawerShown,
isSubToolbarShown, isSubToolbarShown,
toggleSubToolbar,
}; };
}); });