fix(components): [dialog] fix dialog not fill full screen after drag (#5875)

This commit is contained in:
bqy 2022-02-11 00:07:06 +08:00 committed by GitHub
parent 09ebf1bed8
commit 1d8584d627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ export const useDialog = (
{ emit }: SetupContext<DialogEmits>,
targetRef: Ref<HTMLElement | undefined>
) => {
let lastPosition = ''
const visible = ref(false)
const closed = ref(false)
const rendered = ref(false) // when desctroyOnClose is true, we initialize it as false vise versa
@ -158,6 +159,19 @@ export const useDialog = (
}
)
watch(
() => props.fullscreen,
(val) => {
if (!targetRef.value) return
if (val) {
lastPosition = targetRef.value.style.transform
targetRef.value.style.transform = ''
} else {
targetRef.value.style.transform = lastPosition
}
}
)
onMounted(() => {
if (props.modelValue) {
visible.value = true