fix: initial modal scroll lock (#2489)
continuous-integration/drone/push Build is passing Details

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: #2489
Reviewed-by: konrad <k@knt.li>
Co-authored-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
Co-committed-by: Dominik Pschenitschni <dpschen@noreply.kolaente.de>
This commit is contained in:
Dominik Pschenitschni 2022-10-04 19:41:41 +00:00 committed by konrad
parent e2f02cfc61
commit eae7cc5a6b
1 changed files with 4 additions and 10 deletions

View File

@ -71,10 +71,9 @@ export default {
<script lang="ts" setup>
import BaseButton from '@/components/base/BaseButton.vue'
import {onUnmounted, ref, useAttrs, watch} from 'vue'
import {ref, useAttrs, watchEffect} from 'vue'
import {useScrollLock} from '@vueuse/core'
const props = withDefaults(defineProps<{
enabled?: boolean,
overflow?: boolean,
@ -94,14 +93,9 @@ const attrs = useAttrs()
const modal = ref<HTMLElement | null>(null)
const scrollLock = useScrollLock(modal)
watch(
() => props.enabled,
enabled => {
scrollLock.value = enabled
},
)
onUnmounted(() => scrollLock.value = false)
watchEffect(() => {
scrollLock.value = props.enabled
})
</script>
<style lang="scss" scoped>