[Improvement] Actionsheet: support lazy render (#1365)

This commit is contained in:
neverland
2018-06-29 20:34:55 +08:00
committed by GitHub
parent 35a28df51f
commit 0afbd92d32
8 changed files with 27 additions and 60 deletions

View File

@@ -1,6 +1,6 @@
<template>
<transition :name="currentTransition">
<div v-if="inited || !lazyRender" v-show="value" :class="b({ [position]: position })">
<div v-if="shouldRender" v-show="value" :class="b({ [position]: position })">
<slot />
</div>
</transition>
@@ -17,10 +17,6 @@ export default create({
props: {
transition: String,
lazyRender: {
type: Boolean,
default: true
},
overlay: {
type: Boolean,
default: true
@@ -35,22 +31,10 @@ export default create({
}
},
data() {
return {
inited: this.value
};
},
computed: {
currentTransition() {
return this.transition || (this.position === '' ? 'van-fade' : `popup-slide-${this.position}`);
}
},
watch: {
value() {
this.inited = this.inited || this.value;
}
}
});
</script>