[bugfix] List: should not trigger load event when hidden (#751)

This commit is contained in:
neverland 2018-03-22 13:18:38 +08:00 committed by GitHub
parent 70fbdea35d
commit ddbe338919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -3,7 +3,7 @@
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<p class="page-desc">{{ $t('text') }}</p> <p class="page-desc">{{ $t('text') }}</p>
<van-pull-refresh v-model="refreshing" @refresh="onRefresh"> <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
@load="onLoad" @load="onLoad"
@ -39,7 +39,7 @@ export default {
onLoad() { onLoad() {
setTimeout(() => { setTimeout(() => {
for (let i = 0; i < 10; i++) { for (let i = 0; i < 10; i++) {
let text = this.list.length + 1; const text = this.list.length + 1;
this.list.push(text < 10 ? '0' + text : text); this.list.push(text < 10 ? '0' + text : text);
} }
this.loading = false; this.loading = false;

View File

@ -79,7 +79,7 @@ export default create({
const scrollerHeight = utils.getVisibleHeight(scroller); const scrollerHeight = utils.getVisibleHeight(scroller);
/* istanbul ignore next */ /* istanbul ignore next */
if (!scrollerHeight) { if (!scrollerHeight || utils.getComputedStyle(el).display === 'none') {
return; return;
} }

View File

@ -46,15 +46,15 @@ export default {
x: 0, x: 0,
y: 0 y: 0
}; };
if (this.value) {
this.open();
}
}, },
mounted() { mounted() {
if (this.getContainer) { if (this.getContainer) {
this.move(); this.move();
} }
if (this.value) {
this.open();
}
}, },
beforeDestroy() { beforeDestroy() {