forked from FoundKeyGang/FoundKey
Update timeline.vue
This commit is contained in:
parent
83327fc477
commit
50baad1fd0
1 changed files with 13 additions and 2 deletions
|
@ -37,7 +37,8 @@ export default Vue.extend({
|
||||||
notes: [],
|
notes: [],
|
||||||
existMore: false,
|
existMore: false,
|
||||||
connection: null,
|
connection: null,
|
||||||
connectionId: null
|
connectionId: null,
|
||||||
|
isTop: true;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -53,6 +54,8 @@ export default Vue.extend({
|
||||||
this.connection.on('follow', this.onChangeFollowing);
|
this.connection.on('follow', this.onChangeFollowing);
|
||||||
this.connection.on('unfollow', this.onChangeFollowing);
|
this.connection.on('unfollow', this.onChangeFollowing);
|
||||||
|
|
||||||
|
window.addEventListener('scroll', this.onScroll);
|
||||||
|
|
||||||
this.fetch();
|
this.fetch();
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -95,11 +98,19 @@ export default Vue.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onNote(note) {
|
onNote(note) {
|
||||||
this.notes.pop();
|
if (this.isTop) this.notes.pop();
|
||||||
this.notes.unshift(note);
|
this.notes.unshift(note);
|
||||||
},
|
},
|
||||||
onChangeFollowing() {
|
onChangeFollowing() {
|
||||||
this.fetch();
|
this.fetch();
|
||||||
|
},
|
||||||
|
onScroll() {
|
||||||
|
if ((this as any).os.i.clientSettings.fetchOnScroll !== false) {
|
||||||
|
const current = window.scrollY + window.innerHeight;
|
||||||
|
if (current > document.body.offsetHeight - 8) this.more();
|
||||||
|
}
|
||||||
|
if (window.scrollY > 100) this.isTop = false;
|
||||||
|
else this.isTop = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue