Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/components/x-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
class="vux-x-dialog"
:class="{'vux-x-dialog-absolute': layout === 'VIEW_BOX'}">
<transition :name="maskTransition">
<div class="weui-mask" @click="hide" v-show="show" :style="maskStyle"></div>
<div class="weui-mask" @click="hide" v-show="dialogShow" :style="maskStyle"></div>
</transition>
<transition :name="dialogTransition">
<div :class="dialogClass" v-show="show" :style="dialogStyle">
<div :class="dialogClass" v-show="dialogShow" :style="dialogStyle">
<slot></slot>
</div>
</transition>
Expand Down Expand Up @@ -65,6 +65,7 @@ export default {
}
},
mounted () {
this.dialogShow = this.show
if (typeof window !== 'undefined') {
if (window.VUX_CONFIG && window.VUX_CONFIG.$layout === 'VIEW_BOX') {
this.layout = 'VIEW_BOX'
Expand All @@ -73,13 +74,16 @@ export default {
},
watch: {
show (val) {
this.$emit('update:show', val)
this.$emit(val ? 'on-show' : 'on-hide')
if (val) {
this.addModalClassName()
} else {
this.removeModalClassName()
}
setTimeout(() => {
this.dialogShow = val
this.$emit('update:show', val)
this.$emit(val ? 'on-show' : 'on-hide')
if (val) {
this.addModalClassName()
} else {
this.removeModalClassName()
}
}, 200)
}
},
methods: {
Expand All @@ -101,7 +105,8 @@ export default {
},
data () {
return {
layout: ''
layout: '',
dialogShow: ''
}
}
}
Expand Down