Authored by yyq

fix scroll

... ... @@ -191,36 +191,39 @@ export default {
}, i <= lastIndex ? (startCol + i) % this.cols : -1);
}
for (let i = 0; i < this.cols; i++) {
let loop = true;
let col = this[this.colPrefix + i];
let k = col.length - 1;
while (loop) {
let cur = col[k];
this.$nextTick(() => {
for (let i = 0; i < this.cols; i++) {
let loop = true;
let col = this[this.colPrefix + i];
let k = col.length - 1;
while (loop) {
let cur = col[k];
if (!cur || cur.height) {
loop = false;
continue;
}
if (!cur || cur.height) {
loop = false;
continue;
}
let dom = this.$refs[`items${cur.index}`];
let dom = this.$refs[`items${cur.index}`];
try {
if (dom && dom[0]) {
cur.height = dom[0].offsetHeight;
cur.top = dom[0].offsetTop;
}
} catch (error) {
const message = `cur_${typeof cur}, dom_ ${typeof dom}, column_${i}, index_ ${index}, length_ ${this.items.length}, ${error ? error.message : ''}`;
try {
if (dom && dom[0]) {
cur.height = dom[0].offsetHeight;
cur.top = dom[0].offsetTop;
throw new Error(message);
}
} catch (error) {
const message = `cur_${typeof cur}, dom_ ${typeof dom}, column_${i}, index_ ${index}, length_ ${this.items.length}, ${error ? error.message : ''}`;
throw new Error(message);
this.$set(this[this.colPrefix + i], k, cur);
k--;
}
this.$set(this[this.colPrefix + i], k, cur);
k--;
}
}
});
return true;
},
loadItem(item, colIndex) {
... ... @@ -281,7 +284,7 @@ export default {
let hasTopItem = false;
for (let i = 0; i < col.length; i++) {
if (i < startIndex - this.size || i > startIndex + this.size) {
if ((i < startIndex - this.size || i > startIndex + this.size) && col[i].height) {
this.$set(col[i], 'placeholder', true);
} else {
this.$set(col[i], 'placeholder', false);
... ...
... ... @@ -236,7 +236,7 @@ export default {
let step = Math.round((scrollTop - 10) / (this._topicHeaderHeight - this._headerHeight) * 100);
if (this.topicInfo.topicImageUrl) {
if (step && this.topicInfo.topicImageUrl) {
this.headerAnimateStep = Math.max(Math.min(step, 100), 0);
}
... ...