[Improvement] Collapse: lazy render (#1513)

This commit is contained in:
neverland
2018-07-20 07:32:29 +08:00
committed by GitHub
parent 191f983e19
commit 93fbf8d417
2 changed files with 11 additions and 22 deletions
+5 -2
View File
@@ -8,7 +8,7 @@
<cell :class="b('title')" is-link @click="onClick">
<slot name="title">{{ title }}</slot>
</cell>
<div v-show="show" ref="wrapper" :class="b('wrapper')" @transitionend="onTransitionEnd">
<div v-if="inited" v-show="show" ref="wrapper" :class="b('wrapper')" @transitionend="onTransitionEnd">
<div ref="content" :class="b('content')">
<slot />
</div>
@@ -33,7 +33,8 @@ export default create({
data() {
return {
show: null
show: null,
inited: null
};
},
@@ -66,6 +67,7 @@ export default create({
this.findParent('van-collapse');
this.items.push(this);
this.show = this.expanded;
this.inited = this.expanded;
},
destroyed() {
@@ -80,6 +82,7 @@ export default create({
if (expanded) {
this.show = true;
this.inited = true;
}
this.$nextTick(() => {