[bugfix] compatible <body /> is the scene of the scrolling container (#3844)

This commit is contained in:
流采
2019-07-15 19:36:21 +08:00
committed by neverland
parent dbe56fd362
commit 511087bc74
6 changed files with 40 additions and 18 deletions
+7 -3
View File
@@ -79,9 +79,14 @@ export default {
},
methods: {
onLoad(index) {
onLoad(index, isRefresh) {
const list = this.list[index];
list.loading = true;
setTimeout(() => {
if (isRefresh) {
list.items = [];
}
for (let i = 0; i < 10; i++) {
const text = list.items.length + 1;
list.items.push(text < 10 ? '0' + text : text);
@@ -104,11 +109,10 @@ export default {
onRefresh(index) {
const list = this.list[index];
setTimeout(() => {
list.items = [];
list.error = false;
list.finished = false;
list.refreshing = false;
window.scrollTo(0, 10);
this.onLoad(index, true);
}, 1000);
}
}