mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] List: should not trigger load event when hidden (#751)
This commit is contained in:
parent
70fbdea35d
commit
ddbe338919
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user