pull/146/head
Merve Özçifçi 2020-01-17 15:45:10 +03:00
parent 172f0a395d
commit 1c7b1aa406
1 changed files with 17 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<div ref="mask" :class="wrapperClass" v-if="visible"> <div ref="mask" :class="wrapperClass" v-if="d_visible">
<transition name="p-dialog" @enter="onEnter" @leave="onLeave" @appear="onAppear"> <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"> <div class="p-dialog-titlebar" v-if="showHeader">
<slot name="header"> <slot name="header">
<span :id="ariaLabelledById" class="p-dialog-title" v-if="header" >{{header}}</span> <span :id="ariaLabelledById" class="p-dialog-title" v-if="header" >{{header}}</span>
@ -57,10 +57,20 @@ export default {
default: 'close' default: 'close'
} }
}, },
watch: {
visible(newValue) {
this.d_visible = newValue;
if(!this.d_visible) {
this.disableModality()
}
}
},
data() { data() {
return { return {
dialogClasses: null, dialogClasses: null,
dialogStyles: null dialogStyles: null,
d_visible: this.visible
} }
}, },
documentKeydownListener: null, documentKeydownListener: null,
@ -82,7 +92,8 @@ export default {
}, },
methods: { methods: {
close() { close() {
this.$emit('update:visible', false); this.d_visible = false;
this.$emit('update:visible', this.d_visible);
}, },
onEnter() { onEnter() {
this.$emit('show'); this.$emit('show');
@ -100,7 +111,7 @@ export default {
this.disableModality(); this.disableModality();
}, },
onAppear() { onAppear() {
if (this.visible) { if (this.d_visible) {
this.onEnter(); this.onEnter();
} }
}, },