Client - hide scrollbar when menu is open on mobile
This commit is contained in:
parent
42c16a9680
commit
6c29050d27
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<NavBar />
|
<NavBar @menuInteraction="updateHideScrollBar" />
|
||||||
<div v-if="appLoading" class="app-container">
|
<div v-if="appLoading" class="app-container">
|
||||||
<div class="app-loading">
|
<div class="app-loading">
|
||||||
<Loader />
|
<Loader />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="app-container">
|
<div v-else class="app-container" :class="{ 'hide-scroll': hideScrollBar }">
|
||||||
<router-view v-if="appConfig" />
|
<router-view v-if="appConfig" />
|
||||||
<NoConfig v-else />
|
<NoConfig v-else />
|
||||||
</div>
|
</div>
|
||||||
@ -28,7 +28,13 @@
|
|||||||
LinearScale,
|
LinearScale,
|
||||||
} from 'chart.js'
|
} from 'chart.js'
|
||||||
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
||||||
import { computed, ComputedRef, defineComponent, onBeforeMount } from 'vue'
|
import {
|
||||||
|
ComputedRef,
|
||||||
|
computed,
|
||||||
|
defineComponent,
|
||||||
|
ref,
|
||||||
|
onBeforeMount,
|
||||||
|
} from 'vue'
|
||||||
|
|
||||||
import Loader from '@/components/Common/Loader.vue'
|
import Loader from '@/components/Common/Loader.vue'
|
||||||
import Footer from '@/components/Footer.vue'
|
import Footer from '@/components/Footer.vue'
|
||||||
@ -63,18 +69,28 @@
|
|||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
const appConfig: ComputedRef<IAppConfig> = computed(
|
const appConfig: ComputedRef<IAppConfig> = computed(
|
||||||
() => store.getters[ROOT_STORE.GETTERS.APP_CONFIG]
|
() => store.getters[ROOT_STORE.GETTERS.APP_CONFIG]
|
||||||
)
|
)
|
||||||
const appLoading: ComputedRef<boolean> = computed(
|
const appLoading: ComputedRef<boolean> = computed(
|
||||||
() => store.getters[ROOT_STORE.GETTERS.APP_LOADING]
|
() => store.getters[ROOT_STORE.GETTERS.APP_LOADING]
|
||||||
)
|
)
|
||||||
|
const hideScrollBar = ref(false)
|
||||||
|
|
||||||
|
function updateHideScrollBar(isMenuOpen: boolean) {
|
||||||
|
hideScrollBar.value = isMenuOpen
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeMount(() =>
|
onBeforeMount(() =>
|
||||||
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_CONFIG)
|
store.dispatch(ROOT_STORE.ACTIONS.GET_APPLICATION_CONFIG)
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
appConfig,
|
appConfig,
|
||||||
appLoading,
|
appLoading,
|
||||||
|
hideScrollBar,
|
||||||
|
updateHideScrollBar,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -85,6 +101,10 @@
|
|||||||
.app-container {
|
.app-container {
|
||||||
height: $app-height;
|
height: $app-height;
|
||||||
|
|
||||||
|
&.hide-scroll {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.app-loading {
|
.app-loading {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -89,7 +89,8 @@
|
|||||||
components: {
|
components: {
|
||||||
Dropdown,
|
Dropdown,
|
||||||
},
|
},
|
||||||
setup() {
|
emits: ['menuInteraction'],
|
||||||
|
setup(props, { emit }) {
|
||||||
const { t, locale, availableLocales } = useI18n()
|
const { t, locale, availableLocales } = useI18n()
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|
||||||
@ -116,9 +117,11 @@
|
|||||||
|
|
||||||
function openMenu() {
|
function openMenu() {
|
||||||
isMenuOpen.value = true
|
isMenuOpen.value = true
|
||||||
|
emit('menuInteraction', true)
|
||||||
}
|
}
|
||||||
function closeMenu() {
|
function closeMenu() {
|
||||||
isMenuOpen.value = false
|
isMenuOpen.value = false
|
||||||
|
emit('menuInteraction', false)
|
||||||
}
|
}
|
||||||
function updateLanguage(option: IDropdownOption) {
|
function updateLanguage(option: IDropdownOption) {
|
||||||
locale.value = option.value.toString()
|
locale.value = option.value.toString()
|
||||||
@ -282,7 +285,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
z-index: 1;
|
z-index: 1001;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user