fix: initial modal scroll lock #2489

Merged
konrad merged 1 commits from dpschen/frontend:feature/fix-initial-modal-scroll-lock into main 2022-10-04 19:41:42 +00:00
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>