fix: initial modal scroll lock (#2489)

Co-authored-by: Dominik Pschenitschni <mail@celement.de>
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/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

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>