...
|
...
|
@@ -125,6 +125,7 @@ export default { |
|
|
});
|
|
|
},
|
|
|
data(newVal,oldVal) {
|
|
|
console.log('watchData:', newVal.length, oldVal.length);
|
|
|
this.$nextTick(() => {
|
|
|
clearTimeout(this.timer);
|
|
|
this.timer = setTimeout(() => {
|
...
|
...
|
@@ -134,7 +135,7 @@ export default { |
|
|
if (newVal.length < this.loadedIndex) {
|
|
|
this.loadedIndex = 0
|
|
|
}
|
|
|
if (newVal.length>oldVal.length || newVal.length > this.loadedIndex) {
|
|
|
if (newVal.length > oldVal.length || newVal.length > this.loadedIndex) {
|
|
|
if (newVal.length === oldVal.length) {
|
|
|
this.resize(this.loadedIndex > 0 ? this.loadedIndex : null);
|
|
|
return;
|
...
|
...
|
@@ -237,6 +238,7 @@ export default { |
|
|
}
|
|
|
},
|
|
|
async resize(index, elements) { // resize and render
|
|
|
console.log('resize:', index, elements);
|
|
|
this.isresizing = true;
|
|
|
var self = this;
|
|
|
if (!this.$slots.default) {
|
...
|
...
|
@@ -337,11 +339,9 @@ export default { |
|
|
const scrollTop = this.height ? this.root.scrollTop : document.documentElement.scrollTop || document.body.scrollTop || this.scrollTop
|
|
|
const scrollHeight = this.height ? this.root.scrollHeight : this.root.scrollHeight; //document.documentElement.offsetHeight
|
|
|
var diff = scrollHeight - scrollTop - self.clientHeight;
|
|
|
|
|
|
// console.log('scrollTop=', scrollTop, 'scrollHeight=', scrollHeight, 'diff=', diff, 'max=', self.max);
|
|
|
|
|
|
self.$emit('scroll', {scrollHeight: scrollHeight, scrollTop: scrollTop, clientHeight: self.clientHeight, diff: diff, time: Date.now()})
|
|
|
if (diff < self.max && self.loadmore && scrollHeight > self.clientHeight) {
|
|
|
if (diff < self.max && self.loadmore && scrollHeight > self.clientHeight && this.loadedIndex >= this.data.length - 1) {
|
|
|
self.lastScrollTop = scrollTop;
|
|
|
self.loadmore = false;
|
|
|
self.$emit('loadmore');
|
...
|
...
|
|