Skip to content

Commit

Permalink
Fixed #145
Browse files Browse the repository at this point in the history
  • Loading branch information
Merve7 committed Jan 17, 2020
1 parent d944b45 commit fb253ef
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/components/dialog/Dialog.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div ref="mask" :class="wrapperClass" v-if="visible">
<div ref="mask" :class="wrapperClass" v-if="d_visible || blockScroll">
<transition name="p-dialog" @enter="onEnter" @leave="onLeave" @appear="onAppear">
<div ref="container" :class="containerClass" :style="containerStyle" v-if="visible" v-bind="$attrs" v-on="listeners" role="dialog" :aria-labelledby="ariaLabelledById" :aria-modal="modal">
<div ref="container" :class="containerClass" :style="containerStyle" v-if="d_visible" v-bind="$attrs" v-on="listeners" role="dialog" :aria-labelledby="ariaLabelledById" :aria-modal="modal">
<div class="p-dialog-titlebar" v-if="showHeader">
<slot name="header">
<span :id="ariaLabelledById" class="p-dialog-title" v-if="header" >{{header}}</span>
Expand Down Expand Up @@ -60,7 +60,21 @@ export default {
data() {
return {
dialogClasses: null,
dialogStyles: null
dialogStyles: null,
d_visible: this.visible,
blockScroll: false,
}
},
watch: {
visible(newValue) {
this.d_visible = newValue;
if(this.d_visible && this.modal) {
this.blockScroll = true;
}
else {
Promise.resolve(null).then(() => this.blockScroll = false);
}
}
},
documentKeydownListener: null,
Expand All @@ -82,7 +96,9 @@ export default {
},
methods: {
close() {
this.$emit('update:visible', false);
this.d_visible = false;
this.$emit('update:visible', this.d_visible);
},
onEnter() {
this.$emit('show');
Expand All @@ -100,7 +116,7 @@ export default {
this.disableModality();
},
onAppear() {
if (this.visible) {
if (this.d_visible) {
this.onEnter();
}
},
Expand Down Expand Up @@ -341,4 +357,4 @@ export default {
-webkit-transition: height .3s;
transition: height .3s;
}
</style>
</style>

0 comments on commit fb253ef

Please sign in to comment.