[bugfix] Popup modal display error

This commit is contained in:
陈嘉涵
2017-10-16 16:24:10 +08:00
parent ed26ed2284
commit ade8a97d6d
7 changed files with 100 additions and 236 deletions

View File

@@ -1,6 +1,6 @@
<template>
<transition :name="currentTransition">
<div v-show="currentValue" class="van-popup" :class="[position ? 'van-popup--' + position : '']">
<div v-show="value" class="van-popup" :class="[position ? 'van-popup--' + position : '']">
<slot></slot>
</div>
</transition>
@@ -8,29 +8,23 @@
<script>
import Popup from '../mixins/popup';
export default {
name: 'van-popup',
mixins: [Popup],
props: {
transition: String,
overlay: {
default: true
},
lockOnScroll: {
default: false
},
closeOnClickOverlay: {
default: true
},
transition: {
type: String,
default: 'popup-slide'
},
position: {
type: String,
default: ''
@@ -38,31 +32,15 @@ export default {
},
data() {
const transition = this.transition || (this.position === '' ? 'popup-fade' : `popup-slide-${this.position}`);
return {
currentValue: false,
currentTransition: this.transition
currentTransition: transition
};
},
watch: {
currentValue(val) {
this.$emit('input', val);
},
value(val) {
this.currentValue = val;
}
},
beforeMount() {
if (this.transition !== 'popup-fade') {
this.currentTransition = `popup-slide-${this.position}`;
}
},
mounted() {
if (this.value) {
this.currentValue = true;
this.open();
}
}